c0a3d77158a1a1d270e4ae24676e3d57b54a09ee
[WebKit-https.git] / LayoutTests / http / tests / websocket / tests / hybi / handshake-fail-by-extensions-header_wsh.py
1 from mod_pywebsocket.handshake.hybi06 import compute_accept
2
3
4 def web_socket_do_extra_handshake(request):
5     message = 'HTTP/1.1 101 Switching Protocols\r\n'
6     message += 'Upgrade: websocket\r\n'
7     message += 'Connection: Upgrade\r\n'
8     message += 'Sec-WebSocket-Accept: %s\r\n' % compute_accept(request.headers_in['Sec-WebSocket-Key'])[0]
9     message += 'Sec-WebSocket-Extensions: x-foo\r\n'
10     message += '\r\n'
11     request.connection.write(message)
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