Fix websocket service disconnect on invalid handshake (#7447)

This commit is contained in:
frytimo
2025-08-05 12:05:48 -03:00
committed by GitHub
parent 0157a58639
commit dc56886d41
4 changed files with 57 additions and 12 deletions
@@ -345,7 +345,7 @@ class websocket_server {
}
}
if (!preg_match("/Sec-WebSocket-Key: (.*)\r\n/", $request_header, $matches)) {
throw new \RuntimeException("Invalid WebSocket handshake");
throw new \invalid_handshake_exception($socket, "Invalid WebSocket handshake");
}
$key = trim($matches[1]);
$accept_key = base64_encode(