| OLD | NEW |
| 1 # Copyright 2013, Google Inc. All rights reserved. | 1 # Copyright 2013, Google Inc. All rights reserved. |
| 2 # | 2 # |
| 3 # Redistribution and use in source and binary forms, with or without | 3 # Redistribution and use in source and binary forms, with or without |
| 4 # modification, are permitted provided that the following conditions are | 4 # modification, are permitted provided that the following conditions are |
| 5 # met: | 5 # met: |
| 6 # | 6 # |
| 7 # * Redistributions of source code must retain the above copyright | 7 # * Redistributions of source code must retain the above copyright |
| 8 # notice, this list of conditions and the following disclaimer. | 8 # notice, this list of conditions and the following disclaimer. |
| 9 # * Redistributions in binary form must reproduce the above | 9 # * Redistributions in binary form must reproduce the above |
| 10 # copyright notice, this list of conditions and the following disclaimer | 10 # copyright notice, this list of conditions and the following disclaimer |
| (...skipping 17 matching lines...) Expand all Loading... |
| 28 | 28 |
| 29 | 29 |
| 30 import urlparse | 30 import urlparse |
| 31 | 31 |
| 32 | 32 |
| 33 def web_socket_do_extra_handshake(request): | 33 def web_socket_do_extra_handshake(request): |
| 34 query = urlparse.urlparse(request.uri)[4] | 34 query = urlparse.urlparse(request.uri)[4] |
| 35 max_age = '' | 35 max_age = '' |
| 36 if 'clear' in urlparse.parse_qs(query): | 36 if 'clear' in urlparse.parse_qs(query): |
| 37 max_age = '; Max-Age=0' | 37 max_age = '; Max-Age=0' |
| 38 request.extra_headers.append( | 38 cookie_values = [ |
| 39 ('Set-Cookie', 'WK-WebSocket-test-domain-pass=1; Domain=127.0.0.1' + max
_age)) | 39 'ws-domain-local-ip=1; Domain=127.0.0.1' + max_age, |
| 40 request.extra_headers.append( | 40 'ws-domain-example-com=1; Domain=example.com' + max_age, |
| 41 ('Set-Cookie', 'WK-WebSocket-test-domain-fail=1; Domain=example.com' + m
ax_age)) | 41 'ws-path-root=1; Path=/' + max_age, |
| 42 request.extra_headers.append( | 42 'ws-path-foobar=1; Path=/foo/bar' + max_age, |
| 43 ('Set-Cookie', 'WK-WebSocket-test-path-pass=1; Path=/' + max_age)) | 43 'ws=1' + max_age, |
| 44 request.extra_headers.append( | 44 ] |
| 45 ('Set-Cookie', 'WK-WebSocket-test-path-fail=1; Path=/foo/bar' + max_age)
) | 45 for value in cookie_values: |
| 46 request.extra_headers.append(('Set-Cookie', | 46 request.extra_headers.append(('Set-Cookie', value)) |
| 47 'WK-WebSocket-test=1' + max_age)) | |
| 48 | 47 |
| 49 | 48 |
| 50 def web_socket_transfer_data(request): | 49 def web_socket_transfer_data(request): |
| 51 request.ws_stream.send_message('url = ' + request.uri) | 50 request.ws_stream.send_message('url = ' + request.uri) |
| 52 | 51 |
| 53 | 52 |
| 54 # vi:sts=4 sw=4 et | 53 # vi:sts=4 sw=4 et |
| OLD | NEW |