| OLD | NEW |
| 1 #!/usr/bin/env python | 1 #!/usr/bin/env python |
| 2 # Copyright (c) 2012 The Chromium Authors. All rights reserved. | 2 # Copyright (c) 2012 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/SYNC/TCP/UDP/ server used for testing Chrome. | 6 """This is a simple HTTP/FTP/SYNC/TCP/UDP/ 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 798 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 809 def EchoAllHandler(self): | 809 def EchoAllHandler(self): |
| 810 """This handler yields a (more) human-readable page listing information | 810 """This handler yields a (more) human-readable page listing information |
| 811 about the request header & contents.""" | 811 about the request header & contents.""" |
| 812 | 812 |
| 813 if not self._ShouldHandleRequest("/echoall"): | 813 if not self._ShouldHandleRequest("/echoall"): |
| 814 return False | 814 return False |
| 815 | 815 |
| 816 self.send_response(200) | 816 self.send_response(200) |
| 817 self.send_header('Content-Type', 'text/html') | 817 self.send_header('Content-Type', 'text/html') |
| 818 self.end_headers() | 818 self.end_headers() |
| 819 self.wfile.write('<html><head><style>' | 819 self.wfile.write('<html><head><title>echoall</title><style>' |
| 820 'pre { border: 1px solid black; margin: 5px; padding: 5px }' | 820 'pre { border: 1px solid black; margin: 5px; padding: 5px }' |
| 821 '</style></head><body>' | 821 '</style></head><body>' |
| 822 '<div style="float: right">' | 822 '<div style="float: right">' |
| 823 '<a href="/echo">back to referring page</a></div>' | 823 '<a href="/echo">back to referring page</a></div>' |
| 824 '<h1>Request Body:</h1><pre>') | 824 '<h1>Request Body:</h1><pre>') |
| 825 | 825 |
| 826 if self.command == 'POST' or self.command == 'PUT': | 826 if self.command == 'POST' or self.command == 'PUT': |
| 827 qs = self.ReadRequestBody() | 827 qs = self.ReadRequestBody() |
| 828 params = cgi.parse_qs(qs, keep_blank_values=1) | 828 params = cgi.parse_qs(qs, keep_blank_values=1) |
| 829 | 829 |
| (...skipping 1657 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 2487 help='Hostname or IP upon which the server will ' | 2487 help='Hostname or IP upon which the server will ' |
| 2488 'listen. Client connections will also only be ' | 2488 'listen. Client connections will also only be ' |
| 2489 'allowed from this address.') | 2489 'allowed from this address.') |
| 2490 option_parser.add_option('', '--auth-token', dest='auth_token', | 2490 option_parser.add_option('', '--auth-token', dest='auth_token', |
| 2491 help='Specify the auth token which should be used' | 2491 help='Specify the auth token which should be used' |
| 2492 'in the authorization header for GData.') | 2492 'in the authorization header for GData.') |
| 2493 main_options, main_args = option_parser.parse_args() | 2493 main_options, main_args = option_parser.parse_args() |
| 2494 | 2494 |
| 2495 sys.exit(main(main_options, main_args)) | 2495 sys.exit(main(main_options, main_args)) |
| 2496 | 2496 |
| OLD | NEW |