OLD | NEW |
1 #!/usr/bin/python2.4 | 1 #!/usr/bin/python2.4 |
2 # Copyright (c) 2006-2010 The Chromium Authors. All rights reserved. | 2 # Copyright (c) 2006-2010 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 server used for testing Chrome. | 6 """This is a simple HTTP server used for testing Chrome. |
7 | 7 |
8 It supports several test URLs, as specified by the handlers in TestPageHandler. | 8 It supports several test URLs, as specified by the handlers in TestPageHandler. |
9 By default, it listens on an ephemeral port and sends the port number back to | 9 By default, it listens on an ephemeral port and sends the port number back to |
10 the originating process over a pipe. The originating process can specify an | 10 the originating process over a pipe. The originating process can specify an |
(...skipping 1321 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1332 def ChromiumSyncCommandHandler(self): | 1332 def ChromiumSyncCommandHandler(self): |
1333 """Handle a chromiumsync command arriving via http. | 1333 """Handle a chromiumsync command arriving via http. |
1334 | 1334 |
1335 This covers all sync protocol commands: authentication, getupdates, and | 1335 This covers all sync protocol commands: authentication, getupdates, and |
1336 commit. | 1336 commit. |
1337 """ | 1337 """ |
1338 test_name = "/chromiumsync/command" | 1338 test_name = "/chromiumsync/command" |
1339 if not self._ShouldHandleRequest(test_name): | 1339 if not self._ShouldHandleRequest(test_name): |
1340 return False | 1340 return False |
1341 | 1341 |
1342 raw_request = self.ReadRequestBody() | 1342 length = int(self.headers.getheader('content-length')) |
| 1343 raw_request = self.rfile.read(length) |
1343 | 1344 |
1344 http_response, raw_reply = self.server.HandleCommand( | 1345 http_response, raw_reply = self.server.HandleCommand( |
1345 self.path, raw_request) | 1346 self.path, raw_request) |
1346 self.send_response(http_response) | 1347 self.send_response(http_response) |
1347 self.end_headers() | 1348 self.end_headers() |
1348 self.wfile.write(raw_reply) | 1349 self.wfile.write(raw_reply) |
1349 return True | 1350 return True |
1350 | 1351 |
1351 | 1352 |
1352 def MakeDataDir(): | 1353 def MakeDataDir(): |
(...skipping 159 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1512 'option may appear multiple times, indicating ' | 1513 'option may appear multiple times, indicating ' |
1513 'multiple algorithms should be enabled.'); | 1514 'multiple algorithms should be enabled.'); |
1514 option_parser.add_option('', '--file-root-url', default='/files/', | 1515 option_parser.add_option('', '--file-root-url', default='/files/', |
1515 help='Specify a root URL for files served.') | 1516 help='Specify a root URL for files served.') |
1516 option_parser.add_option('', '--startup-pipe', type='int', | 1517 option_parser.add_option('', '--startup-pipe', type='int', |
1517 dest='startup_pipe', | 1518 dest='startup_pipe', |
1518 help='File handle of pipe to parent process') | 1519 help='File handle of pipe to parent process') |
1519 options, args = option_parser.parse_args() | 1520 options, args = option_parser.parse_args() |
1520 | 1521 |
1521 sys.exit(main(options, args)) | 1522 sys.exit(main(options, args)) |
OLD | NEW |