ext negotiation tolerate semicolon args
Signed-off-by: Andy Green <andy.green@linaro.org>
This commit is contained in:
parent
86c1ef1e7c
commit
2b35e123f4
2 changed files with 19 additions and 0 deletions
|
@ -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 {
|
||||
|
|
|
@ -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 {
|
||||
|
|
Loading…
Add table
Reference in a new issue