Merge Chromium + Blink git repositories
[chromium-blink-merge.git] / third_party / WebKit / LayoutTests / http / tests / websocket / too-long-payload_wsh.py
blobc83f22cb7336dd128f7cc0be57403b9ba625189c
1 import struct
2 import time
3 from mod_pywebsocket import common
6 def web_socket_do_extra_handshake(request):
7 pass
10 def web_socket_transfer_data(request):
11 length = 0x8000000000000000
13 # pywebsocket refuses to send a frame with too long payload.
14 # Thus, we need to build a frame manually.
15 header = chr(0x80 | common.OPCODE_TEXT) # 0x80 is for "fin" bit.
16 header += chr(127)
17 header += struct.pack('!Q', length)
18 request.connection.write(header)
20 # Send data indefinitely to simulate a real (broken) server sending a big frame.
21 # A client should ignore these bytes and abort the connection.
22 while True:
23 request.connection.write('X' * 4096)
24 time.sleep(1)