Merge pull request #4132 from sab24/master

Fixes Firefox WebSocket upgrade request in WebSocket engine
This commit is contained in:
Doron Somech 2021-01-30 23:09:52 +02:00 committed by GitHub
commit b3722cf983
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
2 changed files with 26 additions and 3 deletions

14
RELICENSE/sab24.md Normal file
View File

@ -0,0 +1,14 @@
# Permission to Relicense under MPLv2 or any other OSI approved license chosen by the current ZeroMQ BDFL
This is a statement by Bart Smink
that grants permission to relicense its copyrights in the libzmq C++
library (ZeroMQ) under the Mozilla Public License v2 (MPLv2) or any other
Open Source Initiative approved license chosen by the current
ZeroMQ BDFL (Benevolent Dictator for Life).
A portion of the commits made by the Github handle "sab24", with
commit author "sab24 <sab24@github.com>", are copyright of Bart Smink.
This document hereby grants the libzmq project team to relicense libzmq,
including all past, present and future contributions of the author listed above.
Bart Smink 2021/01/30

View File

@ -453,9 +453,18 @@ bool zmq::ws_engine_t::server_handshake ()
if (strcasecmp ("upgrade", _header_name) == 0)
_header_upgrade_websocket =
strcasecmp ("websocket", _header_value) == 0;
else if (strcasecmp ("connection", _header_name) == 0)
_header_connection_upgrade =
strcasecmp ("upgrade", _header_value) == 0;
else if (strcasecmp ("connection", _header_name) == 0){
char *element = strtok (_header_value, ",");
while (element != NULL){
while (*element == ' ')
element++;
if (strcasecmp ("upgrade", element) == 0){
_header_connection_upgrade = true;
break;
}
element = strtok (NULL, ",");
}
}
else if (strcasecmp ("Sec-WebSocket-Key", _header_name)
== 0)
strcpy_s (_websocket_key, _header_value);