From d515ddd51d6fa0061f4bed865de2dc7ab5cf24fc Mon Sep 17 00:00:00 2001 From: Artem Egorkine Date: Wed, 23 Nov 2011 10:46:24 +0200 Subject: [PATCH] Don't care for the human-readable part of "HTTP/1.1 101" reply While the protocol specification gives example of the human-readable message associated with a 101-code reply, nowhere does it actually enforce it. Ws4py gevent middleware is known to have a message other than "Switching Protocols". --- lib/libwebsockets.c | 7 +++---- 1 file changed, 3 insertions(+), 4 deletions(-) diff --git a/lib/libwebsockets.c b/lib/libwebsockets.c index f8522b5..6baf2c7 100644 --- a/lib/libwebsockets.c +++ b/lib/libwebsockets.c @@ -1089,8 +1089,8 @@ lws_client_interpret_server_handshake(struct libwebsocket_context *context, } strtolower(wsi->utf8_token[WSI_TOKEN_HTTP].token); - if (strcmp(wsi->utf8_token[WSI_TOKEN_HTTP].token, - "101 websocket protocol handshake")) { + if (strncmp(wsi->utf8_token[WSI_TOKEN_HTTP].token, + "101", 3)) { fprintf(stderr, "libwebsocket_client_handshake " "server sent bad HTTP response '%s'\n", wsi->utf8_token[WSI_TOKEN_HTTP].token); @@ -1145,8 +1145,7 @@ lws_client_interpret_server_handshake(struct libwebsocket_context *context, */ strtolower(wsi->utf8_token[WSI_TOKEN_HTTP].token); - if (strcmp(wsi->utf8_token[WSI_TOKEN_HTTP].token, - "101 switching protocols")) { + if (strncmp(wsi->utf8_token[WSI_TOKEN_HTTP].token, "101", 3)) { fprintf(stderr, "libwebsocket_client_handshake " "server sent bad HTTP response '%s'\n", wsi->utf8_token[WSI_TOKEN_HTTP].token); -- 2.7.4