(websocket server) Handle and accept firefox browser special upgrade value (keep-alive, Upgrade)

This commit is contained in:
Benjamin Sergeant 2021-05-27 10:54:10 -07:00
parent 97fedf9482
commit e3c98a03cc
5 changed files with 12 additions and 4 deletions

View File

@ -2,6 +2,10 @@
All changes to this project will be documented in this file.
## [11.2.7] - 2021-05-27
(websocket server) Handle and accept firefox browser special upgrade value (keep-alive, Upgrade)
## [11.2.6] - 2021-05-18
(Windows) move EINVAL (re)definition from IXSocket.h to IXNetSystem.h (fix #289)

View File

@ -137,7 +137,7 @@ namespace ix
{
contentLength = std::stoi(headers["Content-Length"]);
}
catch(const std::exception&)
catch (const std::exception&)
{
return std::make_tuple(
false, "Error parsing HTTP Header 'Content-Length'", httpRequest);

View File

@ -204,6 +204,9 @@ namespace ix
// Check the value of the connection field
// Some websocket servers (Go/Gorilla?) send lowercase values for the
// connection header, so do a case insensitive comparison
//
// See https://github.com/apache/thrift/commit/7c4bdf9914fcba6c89e0f69ae48b9675578f084a
//
if (!insensitiveStringCompare(headers["connection"], "Upgrade"))
{
std::stringstream ss;
@ -296,7 +299,8 @@ namespace ix
return sendErrorResponse(400, "Missing Upgrade header");
}
if (!insensitiveStringCompare(headers["upgrade"], "WebSocket"))
if (!insensitiveStringCompare(headers["upgrade"], "WebSocket") &&
headers["Upgrade"] != "keep-alive, Upgrade") // special case for firefox
{
return sendErrorResponse(400,
"Invalid Upgrade header, "

View File

@ -6,4 +6,4 @@
#pragma once
#define IX_WEBSOCKET_VERSION "11.2.6"
#define IX_WEBSOCKET_VERSION "11.2.7"