Make WebSocket suitable for Firefox browser

This commit is contained in:
antao 2019-04-05 13:33:02 +08:00
parent 524ad6ce22
commit 66c518949d
1 changed files with 4 additions and 1 deletions

View File

@ -103,7 +103,10 @@ static bool parseWebsockMessage(MsgBuffer *buffer, std::string &message)
static bool isWebSocket(const HttpRequestImplPtr &req) static bool isWebSocket(const HttpRequestImplPtr &req)
{ {
if (req->getHeaderBy("connection") == "Upgrade" && auto &headers = req->headers();
if (headers.find("upgrade") == headers.end() || headers.find("connection") == headers.end())
return false;
if (req->getHeaderBy("connection").find("Upgrade") != std::string::npos &&
req->getHeaderBy("upgrade") == "websocket") req->getHeaderBy("upgrade") == "websocket")
{ {
LOG_TRACE << "new websocket request"; LOG_TRACE << "new websocket request";