mirror of
https://github.com/adamdruppe/arsd.git
synced 2025-04-27 22:00:13 +03:00
Prevent infinite loop on interrupted websocket
If a websocket message is split across continuation frames, it is possible to get to this inner loop. If the browser is closed in the middle of the message, the connection is closed, which makes the select check return true, but then the other check returns false, indicating eof, but the loop would continue. We do not close the connection here, it just throws, but that's consistent with other things for now. It should probably change too.
This commit is contained in:
parent
8b431196c6
commit
e3d706e3d6
1 changed files with 4 additions and 2 deletions
6
cgi.d
6
cgi.d
|
@ -7080,8 +7080,10 @@ version(cgi_with_websocket) {
|
||||||
return false;
|
return false;
|
||||||
if(!isDataPending())
|
if(!isDataPending())
|
||||||
return true;
|
return true;
|
||||||
while(isDataPending())
|
while(isDataPending()) {
|
||||||
lowLevelReceive();
|
if(lowLevelReceive() == false)
|
||||||
|
throw new ConnectionClosedException("Connection closed in middle of message");
|
||||||
|
}
|
||||||
goto checkAgain;
|
goto checkAgain;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue