3 from mod_pywebsocket
import common
6 def web_socket_do_extra_handshake(request
):
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.
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.
23 request
.connection
.write('X' * 4096)