set-cookie-secure_wsh.py (356B)
1 #!/usr/bin/python 2 import urllib 3 4 5 def web_socket_do_extra_handshake(request): 6 url_parts = urllib.parse.urlsplit(request.uri) 7 request.extra_headers.append(('Set-Cookie', 'ws_test_'+(url_parts.query or '')+'=test; Secure; Path=/')) 8 9 def web_socket_transfer_data(request): 10 # Expect close() from user agent. 11 request.ws_stream.receive_message()