From 0ccf9688bbf96db9238485f94c962d8d109be1c0 Mon Sep 17 00:00:00 2001 From: Andy Green Date: Thu, 17 Jan 2013 00:50:48 +0800 Subject: [PATCH] client allow remote server to accept with no protocol set Needed if our clientside can connect to, eg, echo.websocket.org Signed-off-by: Andy Green --- lib/client.c | 14 ++++++-------- 1 file changed, 6 insertions(+), 8 deletions(-) diff --git a/lib/client.c b/lib/client.c index 027fb77..bb54033 100644 --- a/lib/client.c +++ b/lib/client.c @@ -341,9 +341,8 @@ lws_client_interpret_server_handshake(struct libwebsocket_context *context, if (!wsi->utf8_token[WSI_TOKEN_HTTP].token_len || !wsi->utf8_token[WSI_TOKEN_UPGRADE].token_len || !wsi->utf8_token[WSI_TOKEN_CHALLENGE].token_len || - !wsi->utf8_token[WSI_TOKEN_CONNECTION].token_len || - (!wsi->utf8_token[WSI_TOKEN_PROTOCOL].token_len && - wsi->c_protocol != NULL)) { + !wsi->utf8_token[WSI_TOKEN_CONNECTION].token_len + ) { lwsl_parser("libwebsocket_client_handshake " "missing required header(s)\n"); pkt[len] = '\0'; @@ -396,11 +395,10 @@ lws_client_interpret_server_handshake(struct libwebsocket_context *context, !wsi->utf8_token[WSI_TOKEN_CONNECTION].token_len || !wsi->utf8_token[WSI_TOKEN_ACCEPT].token_len || (!wsi->utf8_token[WSI_TOKEN_NONCE].token_len && - wsi->ietf_spec_revision == 4) || - (!wsi->utf8_token[WSI_TOKEN_PROTOCOL].token_len && - wsi->c_protocol != NULL)) { + wsi->ietf_spec_revision == 4) + ) { lwsl_parser("libwebsocket_client_handshake " - "missing required header(s)\n"); + "missing required header(s) revision=%d\n", wsi->ietf_spec_revision); pkt[len] = '\0'; lwsl_parser("%s", pkt); goto bail3; @@ -453,7 +451,7 @@ select_protocol: if (!wsi->utf8_token[WSI_TOKEN_PROTOCOL].token_len) { - lwsl_warn("lws_client_interpret_server_handshake " + lwsl_info("lws_client_interpret_server_handshake " "WSI_TOKEN_PROTOCOL is null\n"); /* * no protocol name to work from, -- 2.7.4