| 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 656 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 667 self.rfile.read(2) | 667 self.rfile.read(2) |
| 668 return body | 668 return body |
| 669 | 669 |
| 670 def EchoHandler(self): | 670 def EchoHandler(self): |
| 671 """This handler just echoes back the payload of the request, for testing | 671 """This handler just echoes back the payload of the request, for testing |
| 672 form submission.""" | 672 form submission.""" |
| 673 | 673 |
| 674 if not self._ShouldHandleRequest("/echo"): | 674 if not self._ShouldHandleRequest("/echo"): |
| 675 return False | 675 return False |
| 676 | 676 |
| 677 self.send_response(200) | 677 _, _, _, _, query, _ = urlparse.urlparse(self.path) |
| 678 query_params = cgi.parse_qs(query, True) |
| 679 if 'status' in query_params: |
| 680 self.send_response(int(query_params['status'][0])) |
| 681 else: |
| 682 self.send_response(200) |
| 678 self.send_header('Content-Type', 'text/html') | 683 self.send_header('Content-Type', 'text/html') |
| 679 self.end_headers() | 684 self.end_headers() |
| 680 self.wfile.write(self.ReadRequestBody()) | 685 self.wfile.write(self.ReadRequestBody()) |
| 681 return True | 686 return True |
| 682 | 687 |
| 683 def EchoTitleHandler(self): | 688 def EchoTitleHandler(self): |
| 684 """This handler is like Echo, but sets the page title to the request.""" | 689 """This handler is like Echo, but sets the page title to the request.""" |
| 685 | 690 |
| 686 if not self._ShouldHandleRequest("/echotitle"): | 691 if not self._ShouldHandleRequest("/echotitle"): |
| 687 return False | 692 return False |
| (...skipping 1588 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 2276 self.option_parser.add_option('--ocsp-server-unavailable', | 2281 self.option_parser.add_option('--ocsp-server-unavailable', |
| 2277 dest='ocsp_server_unavailable', | 2282 dest='ocsp_server_unavailable', |
| 2278 default=False, action='store_true', | 2283 default=False, action='store_true', |
| 2279 help='If set, the OCSP server will return ' | 2284 help='If set, the OCSP server will return ' |
| 2280 'a tryLater status rather than the actual ' | 2285 'a tryLater status rather than the actual ' |
| 2281 'OCSP response.') | 2286 'OCSP response.') |
| 2282 | 2287 |
| 2283 | 2288 |
| 2284 if __name__ == '__main__': | 2289 if __name__ == '__main__': |
| 2285 sys.exit(ServerRunner().main()) | 2290 sys.exit(ServerRunner().main()) |
| OLD | NEW |