OLD | NEW |
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 1460 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1471 def DataForRange(start, end): | 1471 def DataForRange(start, end): |
1472 """Data to be provided for a particular range of bytes.""" | 1472 """Data to be provided for a particular range of bytes.""" |
1473 # Offset and scale to avoid too obvious (and hence potentially | 1473 # Offset and scale to avoid too obvious (and hence potentially |
1474 # collidable) data. | 1474 # collidable) data. |
1475 return ''.join([chr(y % 256) | 1475 return ''.join([chr(y % 256) |
1476 for y in range(start * 2 + 15, end * 2 + 15, 2)]) | 1476 for y in range(start * 2 + 15, end * 2 + 15, 2)]) |
1477 | 1477 |
1478 if not self._ShouldHandleRequest('/rangereset'): | 1478 if not self._ShouldHandleRequest('/rangereset'): |
1479 return False | 1479 return False |
1480 | 1480 |
| 1481 # HTTP/1.1 is required for ETag and range support. |
| 1482 self.protocol_version = 'HTTP/1.1' |
1481 _, _, url_path, _, query, _ = urlparse.urlparse(self.path) | 1483 _, _, url_path, _, query, _ = urlparse.urlparse(self.path) |
1482 | 1484 |
1483 # Defaults | 1485 # Defaults |
1484 size = 8000 | 1486 size = 8000 |
1485 # Note that the rst is sent just before sending the rst_boundary byte. | 1487 # Note that the rst is sent just before sending the rst_boundary byte. |
1486 rst_boundary = 4000 | 1488 rst_boundary = 4000 |
1487 respond_to_range = True | 1489 respond_to_range = True |
1488 hold_for_signal = False | 1490 hold_for_signal = False |
1489 rst_limit = -1 | 1491 rst_limit = -1 |
1490 token = 'DEFAULT' | 1492 token = 'DEFAULT' |
(...skipping 604 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
2095 '"aes128", "3des", "rc4". If omitted, all ' | 2097 '"aes128", "3des", "rc4". If omitted, all ' |
2096 'algorithms will be used. This option may ' | 2098 'algorithms will be used. This option may ' |
2097 'appear multiple times, indicating ' | 2099 'appear multiple times, indicating ' |
2098 'multiple algorithms should be enabled.'); | 2100 'multiple algorithms should be enabled.'); |
2099 self.option_parser.add_option('--file-root-url', default='/files/', | 2101 self.option_parser.add_option('--file-root-url', default='/files/', |
2100 help='Specify a root URL for files served.') | 2102 help='Specify a root URL for files served.') |
2101 | 2103 |
2102 | 2104 |
2103 if __name__ == '__main__': | 2105 if __name__ == '__main__': |
2104 sys.exit(ServerRunner().main()) | 2106 sys.exit(ServerRunner().main()) |
OLD | NEW |