f88d50010886e2051a09404707558d99b2e017c3
[WebKit-https.git] / LayoutTests / http / tests / websocket / tests / hybi / handshake-fail-by-no-upgrade-header_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 #   Missing '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 += '\r\n'
10     request.connection.write(msg)
11     print msg
12     raise Exception('Abort the connection') # Prevents pywebsocket from sending its own handshake message.
13
14
15 def web_socket_transfer_data(request):
16     pass