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 792 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
803 def EchoAllHandler(self): | 803 def EchoAllHandler(self): |
804 """This handler yields a (more) human-readable page listing information | 804 """This handler yields a (more) human-readable page listing information |
805 about the request header & contents.""" | 805 about the request header & contents.""" |
806 | 806 |
807 if not self._ShouldHandleRequest("/echoall"): | 807 if not self._ShouldHandleRequest("/echoall"): |
808 return False | 808 return False |
809 | 809 |
810 self.send_response(200) | 810 self.send_response(200) |
811 self.send_header('Content-Type', 'text/html') | 811 self.send_header('Content-Type', 'text/html') |
812 self.end_headers() | 812 self.end_headers() |
813 self.wfile.write('<html><head><style>' | 813 self.wfile.write('<html><head><title>echoall</title><style>' |
Charlie Reis
2012/11/20 05:46:03
Let's avoid changing this file if we can. It coul
irobert
2012/11/22 01:37:00
I also had a discussion with Albert about this iss
| |
814 'pre { border: 1px solid black; margin: 5px; padding: 5px }' | 814 'pre { border: 1px solid black; margin: 5px; padding: 5px }' |
815 '</style></head><body>' | 815 '</style></head><body>' |
816 '<div style="float: right">' | 816 '<div style="float: right">' |
817 '<a href="/echo">back to referring page</a></div>' | 817 '<a href="/echo">back to referring page</a></div>' |
818 '<h1>Request Body:</h1><pre>') | 818 '<h1>Request Body:</h1><pre>') |
819 | 819 |
820 if self.command == 'POST' or self.command == 'PUT': | 820 if self.command == 'POST' or self.command == 'PUT': |
821 qs = self.ReadRequestBody() | 821 qs = self.ReadRequestBody() |
822 params = cgi.parse_qs(qs, keep_blank_values=1) | 822 params = cgi.parse_qs(qs, keep_blank_values=1) |
823 | 823 |
(...skipping 1623 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
2447 'should report back to the client as the ' | 2447 'should report back to the client as the ' |
2448 'user owning the token used for making the ' | 2448 'user owning the token used for making the ' |
2449 'policy request.') | 2449 'policy request.') |
2450 self.option_parser.add_option('--auth-token', dest='auth_token', | 2450 self.option_parser.add_option('--auth-token', dest='auth_token', |
2451 help='Specify the auth token which should be ' | 2451 help='Specify the auth token which should be ' |
2452 'used in the authorization header for GData.') | 2452 'used in the authorization header for GData.') |
2453 | 2453 |
2454 | 2454 |
2455 if __name__ == '__main__': | 2455 if __name__ == '__main__': |
2456 sys.exit(ServerRunner().main()) | 2456 sys.exit(ServerRunner().main()) |
OLD | NEW |