[Libwebsockets] [PATCH v2] client: fix verification of the accepted protocol

Alejandro Mery amery at geeks.cl
Wed Dec 10 16:32:44 CET 2014


to properly take ", *" as delimiter

Signed-off-by: Alejandro Mery <amery at geeks.cl>
---
 lib/client.c | 8 ++++----
 1 file changed, 4 insertions(+), 4 deletions(-)

diff --git a/lib/client.c b/lib/client.c
index 4a094a8..831f985 100755
--- a/lib/client.c
+++ b/lib/client.c
@@ -562,13 +562,13 @@ lws_client_interpret_server_handshake(struct libwebsocket_context *context,
 
 	while (pc && *pc && !okay) {
 		if (!strncmp(pc, p, len) &&
-					  (pc[len] == ',' || pc[len] == '\0')) {
+		    (pc[len] == ',' || pc[len] == '\0')) {
 			okay = 1;
 			continue;
 		}
-		while (*pc && *pc != ',')
-			pc++;
-		while (*pc && *pc != ' ')
+		while (*pc && *pc++ != ',')
+			;
+		while (*pc && *pc == ' ')
 			pc++;
 	}
 
-- 
2.1.2




More information about the Libwebsockets mailing list