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

Side by Side Diff: net/tools/testserver/testserver.py

Issue 74523002: [Downloads] Update origin info after each response. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Better descriptions. Created 7 years 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 | Annotate | Revision Log
« no previous file with comments | « content/browser/download/download_stats.cc ('k') | tools/metrics/histograms/histograms.xml » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 #!/usr/bin/env python 1 #!/usr/bin/env python
2 # Copyright 2013 The Chromium Authors. All rights reserved. 2 # Copyright 2013 The Chromium Authors. All rights reserved.
3 # Use of this source code is governed by a BSD-style license that can be 3 # Use of this source code is governed by a BSD-style license that can be
4 # found in the LICENSE file. 4 # found in the LICENSE file.
5 5
6 """This is a simple HTTP/FTP/TCP/UDP/BASIC_AUTH_PROXY/WEBSOCKET server used for 6 """This is a simple HTTP/FTP/TCP/UDP/BASIC_AUTH_PROXY/WEBSOCKET server used for
7 testing Chrome. 7 testing Chrome.
8 8
9 It supports several test URLs, as specified by the handlers in TestPageHandler. 9 It supports several test URLs, as specified by the handlers in TestPageHandler.
10 By default, it listens on an ephemeral port and sends the port number back to 10 By default, it listens on an ephemeral port and sends the port number back to
(...skipping 1552 matching lines...) Expand 10 before | Expand all | Expand 10 after
1563 1563
1564 if range_response: 1564 if range_response:
1565 self.send_response(206) 1565 self.send_response(206)
1566 self.send_header('Content-Range', 1566 self.send_header('Content-Range',
1567 'bytes %d-%d/%d' % (first_byte, last_byte, size)) 1567 'bytes %d-%d/%d' % (first_byte, last_byte, size))
1568 else: 1568 else:
1569 self.send_response(200) 1569 self.send_response(200)
1570 self.send_header('Content-Type', 'application/octet-stream') 1570 self.send_header('Content-Type', 'application/octet-stream')
1571 self.send_header('Content-Length', last_byte - first_byte + 1) 1571 self.send_header('Content-Length', last_byte - first_byte + 1)
1572 if send_verifiers: 1572 if send_verifiers:
1573 self.send_header('Etag', '"XYZZY"') 1573 # If fail_precondition is non-zero, then the ETag for each request will be
1574 # different.
1575 etag = "%s%d" % (token, fail_precondition)
1576 self.send_header('ETag', etag)
1574 self.send_header('Last-Modified', 'Tue, 19 Feb 2013 14:32 EST') 1577 self.send_header('Last-Modified', 'Tue, 19 Feb 2013 14:32 EST')
1575 self.end_headers() 1578 self.end_headers()
1576 1579
1577 if hold_for_signal: 1580 if hold_for_signal:
1578 # TODO(rdsmith/phajdan.jr): http://crbug.com/169519: Without writing 1581 # TODO(rdsmith/phajdan.jr): http://crbug.com/169519: Without writing
1579 # a single byte, the self.server.handle_request() below hangs 1582 # a single byte, the self.server.handle_request() below hangs
1580 # without processing new incoming requests. 1583 # without processing new incoming requests.
1581 self.wfile.write(DataForRange(first_byte, first_byte + 1)) 1584 self.wfile.write(DataForRange(first_byte, first_byte + 1))
1582 first_byte = first_byte + 1 1585 first_byte = first_byte + 1
1583 # handle requests until one of them clears this flag. 1586 # handle requests until one of them clears this flag.
(...skipping 532 matching lines...) Expand 10 before | Expand all | Expand 10 after
2116 '"aes128", "3des", "rc4". If omitted, all ' 2119 '"aes128", "3des", "rc4". If omitted, all '
2117 'algorithms will be used. This option may ' 2120 'algorithms will be used. This option may '
2118 'appear multiple times, indicating ' 2121 'appear multiple times, indicating '
2119 'multiple algorithms should be enabled.'); 2122 'multiple algorithms should be enabled.');
2120 self.option_parser.add_option('--file-root-url', default='/files/', 2123 self.option_parser.add_option('--file-root-url', default='/files/',
2121 help='Specify a root URL for files served.') 2124 help='Specify a root URL for files served.')
2122 2125
2123 2126
2124 if __name__ == '__main__': 2127 if __name__ == '__main__':
2125 sys.exit(ServerRunner().main()) 2128 sys.exit(ServerRunner().main())
OLDNEW
« no previous file with comments | « content/browser/download/download_stats.cc ('k') | tools/metrics/histograms/histograms.xml » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698