mirror of
https://github.com/warmcat/libwebsockets.git
synced 2025-03-09 00:00:04 +01:00
Check status before checking for Sec-WebSocket-Accept
If the server rejects the attempt to establish a connection by returning a response status other than 101, then it will not include the Sec-WebSocket-Accept header. We need to check for 101 status (and return an appropriate error message) before looking for the accept header. See #1200
This commit is contained in:
parent
3e3c270f76
commit
fad43ff8e9
1 changed files with 6 additions and 6 deletions
|
@ -728,12 +728,6 @@ lws_client_interpret_server_handshake(struct lws *wsi)
|
|||
return 0;
|
||||
}
|
||||
|
||||
if (lws_hdr_total_length(wsi, WSI_TOKEN_ACCEPT) == 0) {
|
||||
lwsl_info("no ACCEPT\n");
|
||||
cce = "HS: ACCEPT missing";
|
||||
goto bail3;
|
||||
}
|
||||
|
||||
if (p && strncmp(p, "101", 3)) {
|
||||
lwsl_warn(
|
||||
"lws_client_handshake: got bad HTTP response '%s'\n", p);
|
||||
|
@ -741,6 +735,12 @@ lws_client_interpret_server_handshake(struct lws *wsi)
|
|||
goto bail3;
|
||||
}
|
||||
|
||||
if (lws_hdr_total_length(wsi, WSI_TOKEN_ACCEPT) == 0) {
|
||||
lwsl_info("no ACCEPT\n");
|
||||
cce = "HS: ACCEPT missing";
|
||||
goto bail3;
|
||||
}
|
||||
|
||||
p = lws_hdr_simple_ptr(wsi, WSI_TOKEN_UPGRADE);
|
||||
if (!p) {
|
||||
lwsl_info("no UPGRADE\n");
|
||||
|
|
Loading…
Add table
Reference in a new issue