diff --git a/lib/client.c b/lib/client.c index 51e30f0b..dbb2c367 100644 --- a/lib/client.c +++ b/lib/client.c @@ -514,6 +514,7 @@ lws_client_interpret_server_handshake(struct lws *wsi) const struct lws_extension *ext; char ext_name[128]; const char *c; + char ignore; int more = 1; void *v; #endif @@ -648,15 +649,23 @@ check_extensions: c = (char *)context->serv_buf; n = 0; + ignore = 0; while (more) { if (*c && (*c != ',' && *c != ' ' && *c != '\t')) { + if (*c == ';') + ignore = 1; + if (ignore) { + c++; + continue; + } ext_name[n] = *c++; if (n < sizeof(ext_name) - 1) n++; continue; } ext_name[n] = '\0'; + ignore = 0; if (!*c) more = 0; else { diff --git a/lib/server-handshake.c b/lib/server-handshake.c index 8c3e17c9..c306baa6 100644 --- a/lib/server-handshake.c +++ b/lib/server-handshake.c @@ -33,6 +33,7 @@ lws_extension_server_handshake(struct lws *wsi, char **p) struct lws_context *context = wsi->context; int ext_count = 0; int more = 1; + char ignore; /* * Figure out which extensions the client has that we want to @@ -56,15 +57,24 @@ lws_extension_server_handshake(struct lws *wsi, char **p) lwsl_parser("WSI_TOKEN_EXTENSIONS = '%s'\n", c); wsi->count_active_extensions = 0; n = 0; + ignore = 0; while (more) { if (*c && (*c != ',' && *c != ' ' && *c != '\t')) { + if (ext_name[n] == ';') + ignore = 1; + if (ignore) { + c++; + continue; + } ext_name[n] = *c++; if (n < sizeof(ext_name) - 1) n++; continue; } ext_name[n] = '\0'; + + ignore = 0; if (!*c) more = 0; else {