fix websocket service exit on invalid handshake (#7448)

This commit is contained in:
frytimo
2025-08-05 14:18:38 -03:00
committed by GitHub
parent 7df7bcf131
commit a3260dde54
5 changed files with 95 additions and 12 deletions

View File

@@ -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(