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:
parent
462e0bae0d
commit
abc3a7859e
1 changed files with 6 additions and 4 deletions
10
lib/client.c
10
lib/client.c
|
@ -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++;
|
||||
}
|
||||
|
|
Loading…
Add table
Reference in a new issue