Merge Chromium + Blink git repositories
[chromium-blink-merge.git] / third_party / WebKit / LayoutTests / http / tests / websocket / bad-handshake-crash_wsh.py
blobe3bd90c11a289f70d3b241f07e9df26f576759bc
1 from mod_pywebsocket import handshake
2 from mod_pywebsocket.handshake.hybi import compute_accept
5 def web_socket_do_extra_handshake(request):
6 msg = 'HTTP/1.1 101 Switching Protocols\r\n'
7 msg += 'Upgrade: websocket\r\n'
8 msg += 'Connection: Upgrade\r\n'
9 msg += 'Sec-WebSocket-Accept: %s\r\n' % compute_accept(request.headers_in['Sec-WebSocket-Key'])[0]
10 msg += '\xa5:\r\n'
11 msg += '\r\n'
12 request.connection.write(msg)
13 print msg
14 # Prevents pywebsocket from sending its own handshake message.
15 raise handshake.AbortedByUserException('Abort the connection')
18 def web_socket_transfer_data(request):
19 pass