diff options
Diffstat (limited to 'testing/web-platform/tests/websockets/handlers/wrong_accept_key_wsh.py')
-rwxr-xr-x | testing/web-platform/tests/websockets/handlers/wrong_accept_key_wsh.py | 19 |
1 files changed, 19 insertions, 0 deletions
diff --git a/testing/web-platform/tests/websockets/handlers/wrong_accept_key_wsh.py b/testing/web-platform/tests/websockets/handlers/wrong_accept_key_wsh.py new file mode 100755 index 0000000000..43240e1afb --- /dev/null +++ b/testing/web-platform/tests/websockets/handlers/wrong_accept_key_wsh.py @@ -0,0 +1,19 @@ +#!/usr/bin/python + +import sys, urllib, time + + +def web_socket_do_extra_handshake(request): + msg = (b'HTTP/1.1 101 Switching Protocols:\x0D\x0A' + b'Connection: Upgrade\x0D\x0A' + b'Upgrade: WebSocket\x0D\x0A' + b'Sec-WebSocket-Origin: %s\x0D\x0A' + b'Sec-WebSocket-Accept: thisisawrongacceptkey\x0D\x0A\x0D\x0A') % request.ws_origin.encode('UTF-8') + request.connection.write(msg) + return + + +def web_socket_transfer_data(request): + while True: + request.ws_stream.send_message('test', binary=False) + return |