1
0
Fork 0
mirror of https://github.com/warmcat/libwebsockets.git synced 2025-03-16 00:00:07 +01:00

fix for handling protocol name starting with other protocol name

This commit is contained in:
Rene Jager 2014-12-01 16:28:03 +01:00
parent 462e0bae0d
commit abc3a7859e

View file

@ -588,10 +588,12 @@ lws_client_interpret_server_handshake(struct libwebsocket_context *context,
if (strcmp(p, context->protocols[n].name) == 0) {
wsi->protocol = &context->protocols[n];
break;
}
if (strstr(context->protocols[n].name, p)) {
wsi->protocol = &context->protocols[n];
break;
} else {
char* sp = strstr(context->protocols[n].name, p);
if (sp && (sp[len] == ',' || sp[len] == '\0')) {
wsi->protocol = &context->protocols[n];
break;
}
}
n++;
}