| OLD | NEW |
| 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 msg = 'HTTP/1.1 101 Switching Protocols\r\n' | 6 msg = 'HTTP/1.1 101 Switching Protocols\r\n' |
| 7 msg += 'Upgrade: websocket\r\n' | 7 msg += 'Upgrade: websocket\r\n' |
| 8 msg += 'Connection: Upgrade\r\n' | 8 msg += 'Connection: Upgrade\r\n' |
| 9 msg += 'Sec-WebSocket-Accept: %s\r\n' % compute_accept(request.headers_in['S
ec-WebSocket-Key'])[0] | 9 msg += 'Sec-WebSocket-Accept: %s\r\n' % compute_accept(request.headers_in['S
ec-WebSocket-Key'])[0] |
| 10 msg += 'Sec-WebSocket-Protocol: MismatchProtocol\r\n' | 10 msg += 'Sec-WebSocket-Protocol: MismatchProtocol\r\n' |
| 11 msg += '\r\n' | 11 msg += '\r\n' |
| 12 request.connection.write(msg) | 12 request.connection.write(msg) |
| 13 raise handshake.AbortedByUserException('Abort the connection') # Prevents py
websocket from sending its own handshake message. | 13 raise handshake.AbortedByUserException('Abort the connection') # Prevents py
websocket from sending its own handshake message. |
| 14 | 14 |
| 15 | 15 |
| 16 def web_socket_transfer_data(request): | 16 def web_socket_transfer_data(request): |
| 17 pass | 17 pass |
| OLD | NEW |