Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(2)

Side by Side Diff: third_party/WebKit/LayoutTests/http/tests/websocket/cookie-flood_wsh.py

Issue 2123743002: Rename cookie names in WebSocket cookie tests (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Fixed cookie flooding test amount Created 4 years, 5 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
OLDNEW
1 # Copyright (C) 2013 Google Inc. All rights reserved. 1 # Copyright (C) 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 15 matching lines...) Expand all
26 # (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE 26 # (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
27 # OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. 27 # OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
28 28
29 29
30 from mod_pywebsocket import msgutil 30 from mod_pywebsocket import msgutil
31 31
32 32
33 def web_socket_do_extra_handshake(request): 33 def web_socket_do_extra_handshake(request):
34 # Exact number of headers that will fit in 256KB. Above 256KB an 34 # Exact number of headers that will fit in 256KB. Above 256KB an
35 # ERR_RESPONSE_HEADERS_TOO_BIG error is triggered instead. 35 # ERR_RESPONSE_HEADERS_TOO_BIG error is triggered instead.
36 for i in xrange(5978): 36
37 request.extra_headers.append( 37 name = 'Set-Cookie'
38 ('Set-Cookie', 'WK-websocket-test-flood-%d=1' % i)) 38 common_length = len(name + ': ' + '\r\n')
39
40 i = 0
41 total_length = 0
42 while True:
43 value = 'ws-%d=1' % i
44
45 total_length += common_length + len(value)
46 # Subtract 1KB to make sure we have space for the other headers.
47 if total_length >= 256 * 1024 - 1024:
48 break
49
50 request.extra_headers.append((name, value))
51 i += 1
39 52
40 53
41 def web_socket_transfer_data(request): 54 def web_socket_transfer_data(request):
42 pass 55 pass
OLDNEW
« no previous file with comments | « net/websockets/websocket_stream_test.cc ('k') | third_party/WebKit/LayoutTests/http/tests/websocket/cookie-http-to-ws.pl » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698