projects
/
platform
/
upstream
/
libwebsockets.git
/ commitdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
| commitdiff |
tree
raw
|
patch
| inline |
side by side
(parent:
bfffba9
)
ws-server: restrict returned Sec-Websocket-Protocol to the chosen name only
author
Andy Green
<andy@warmcat.com>
Tue, 29 Nov 2016 12:42:29 +0000
(20:42 +0800)
committer
Andy Green
<andy@warmcat.com>
Tue, 29 Nov 2016 12:42:29 +0000
(20:42 +0800)
https://libwebsockets.org/pipermail/libwebsockets/2016-November/002948.html
lib/server-handshake.c
patch
|
blob
|
history
diff --git
a/lib/server-handshake.c
b/lib/server-handshake.c
index fd126a7596c53899f8aa6619d6f84d5d8a4a5b41..7328e5e264cf81669c3637a0e979e0e164e86ca7 100644
(file)
--- a/
lib/server-handshake.c
+++ b/
lib/server-handshake.c
@@
-214,12
+214,9
@@
handshake_0405(struct lws_context *context, struct lws *wsi)
strcpy(p, (char *)pt->serv_buf);
p += accept_len;
- if (
lws_hdr_total_length(wsi, WSI_TOKEN_PROTOCOL)
) {
+ if (
wsi->protocol->name && wsi->protocol->name[0]
) {
LWS_CPYAPP(p, "\x0d\x0aSec-WebSocket-Protocol: ");
- n = lws_hdr_copy(wsi, p, 128, WSI_TOKEN_PROTOCOL);
- if (n < 0)
- goto bail;
- p += n;
+ p += lws_snprintf(p, 128, "%s", wsi->protocol->name);
}
#ifndef LWS_NO_EXTENSIONS