f9965183e500746911bb3be8f615712fd8c8805d
[WebKit-https.git] / LayoutTests / http / tests / websocket / tests / hybi / handshake-fail-by-no-connection-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     msg += 'Upgrade: websocket\r\n'
7 #   Missing '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