Don't set upgradedWebSocket outside the Http parser
This commit is contained in:
+10
-1
@@ -120,6 +120,9 @@ private:
|
|||||||
/* Cork this socket */
|
/* Cork this socket */
|
||||||
((AsyncSocket<SSL> *) s)->cork();
|
((AsyncSocket<SSL> *) s)->cork();
|
||||||
|
|
||||||
|
/* Mark that we are inside the parser now */
|
||||||
|
httpContextData->isParsingHttp = true;
|
||||||
|
|
||||||
// clients need to know the cursor after http parse, not servers!
|
// clients need to know the cursor after http parse, not servers!
|
||||||
// how far did we read then? we need to know to continue with websocket parsing data? or?
|
// how far did we read then? we need to know to continue with websocket parsing data? or?
|
||||||
|
|
||||||
@@ -220,6 +223,9 @@ private:
|
|||||||
return nullptr;
|
return nullptr;
|
||||||
});
|
});
|
||||||
|
|
||||||
|
/* Mark that we are no longer parsing Http */
|
||||||
|
httpContextData->isParsingHttp = false;
|
||||||
|
|
||||||
/* We need to uncork in all cases, except for nullptr (closed socket, or upgraded socket) */
|
/* We need to uncork in all cases, except for nullptr (closed socket, or upgraded socket) */
|
||||||
if (returnedSocket != nullptr) {
|
if (returnedSocket != nullptr) {
|
||||||
/* Timeout on uncork failure */
|
/* Timeout on uncork failure */
|
||||||
@@ -315,7 +321,10 @@ private:
|
|||||||
void upgradeToWebSocket(void *newSocket) {
|
void upgradeToWebSocket(void *newSocket) {
|
||||||
HttpContextData<SSL> *httpContextData = getSocketContextData();
|
HttpContextData<SSL> *httpContextData = getSocketContextData();
|
||||||
|
|
||||||
httpContextData->upgradedWebSocket = newSocket;
|
/* We should only mark this if inside the parser; if upgrading "async" we cannot set this */
|
||||||
|
if (httpContextData->isParsingHttp) {
|
||||||
|
httpContextData->upgradedWebSocket = newSocket;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
public:
|
public:
|
||||||
|
|||||||
@@ -41,6 +41,7 @@ private:
|
|||||||
|
|
||||||
HttpRouter<RouterData> router;
|
HttpRouter<RouterData> router;
|
||||||
void *upgradedWebSocket = nullptr;
|
void *upgradedWebSocket = nullptr;
|
||||||
|
bool isParsingHttp = false;
|
||||||
};
|
};
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user