Close connection after Websocket handshake
Otherwise we might misinterpret trailing binary data as a second HTTP request. This happens when we return from the handler with data still queued up in the socket.
This commit is contained in:
parent
cb1508fa49
commit
30942f12d3
|
@ -467,6 +467,10 @@ class WebSocketRequestHandler(SimpleHTTPRequestHandler):
|
|||
else:
|
||||
self.send_header("Sec-WebSocket-Protocol", "binary")
|
||||
self.end_headers()
|
||||
|
||||
# Other requests cannot follow Websocket data
|
||||
self.close_connection = True
|
||||
|
||||
return True
|
||||
else:
|
||||
self.send_error(400, "Missing Sec-WebSocket-Version header. Hixie protocols not supported.")
|
||||
|
|
Loading…
Reference in New Issue