a4d48822ba041f5953cd2d66e8164a95ca459f90
[WebKit-https.git] / LayoutTests / http / tests / websocket / tests / hybi / bad-handshake-crash_wsh.py
1 from mod_pywebsocket.handshake.hybi06 import compute_accept
2
3
4 def web_socket_do_extra_handshake(request):
5     msg = "HTTP/1.1 101 Switching Protocols\r\n"
6     msg += "Upgrade: websocket\r\n"
7     msg += "Connection: Upgrade\r\n"
8     msg += "Sec-WebSocket-Accept: %s\r\n" % compute_accept(request.headers_in["Sec-WebSocket-Key"])[0]
9     msg += "\xa5:\r\n"
10     msg += "\r\n"
11     request.connection.write(msg)
12     print msg
13     raise Exception("Abort the connection") # Prevents pywebsocket from sending its own handshake message.
14
15
16 def web_socket_transfer_data(request):
17     pass