Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(1222)

Side by Side Diff: LayoutTests/http/tests/websocket/tests/hybi/handshake-fail-by-null-subprotocol-selection_wsh.py

Issue 22375002: WebSocket must not be established when subprotocol is not selected by the server (Closed) Base URL: https://chromium.googlesource.com/chromium/blink.git@master
Patch Set: Fix test description Created 7 years, 4 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
OLDNEW
1 from mod_pywebsocket import handshake 1 from mod_pywebsocket import handshake
2 from mod_pywebsocket.handshake.hybi import compute_accept 2 from mod_pywebsocket.handshake.hybi import compute_accept
3 3
4 4
5 def web_socket_do_extra_handshake(request): 5 def web_socket_do_extra_handshake(request):
6 message = 'HTTP/1.1 101 Switching Protocols\r\n' 6 message = 'HTTP/1.1 101 Switching Protocols\r\n'
7 message += 'Upgrade: websocket\r\n' 7 message += 'Upgrade: websocket\r\n'
8 message += 'Connection: Upgrade\r\n' 8 message += 'Connection: Upgrade\r\n'
9 message += 'Sec-WebSocket-Accept: %s\r\n' % compute_accept(request.headers_i n['Sec-WebSocket-Key'])[0] 9 message += 'Sec-WebSocket-Accept: %s\r\n' % compute_accept(request.headers_i n['Sec-WebSocket-Key'])[0]
10 message += 'Sec-WebSocket-Extensions: x-foo\r\n'
11 message += '\r\n' 10 message += '\r\n'
12 request.connection.write(message) 11 request.connection.write(message)
13 raise handshake.AbortedByUserException('Abort the connection') # Prevents py websocket from sending its own handshake message. 12 raise handshake.AbortedByUserException('Abort the connection') # Prevents py websocket from sending its own handshake message.
14 13
15 14
16 def web_socket_transfer_data(request): 15 def web_socket_transfer_data(request):
17 pass 16 pass
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698