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 476 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
487 self.DefaultResponseHandler] | 487 self.DefaultResponseHandler] |
488 | 488 |
489 self._mime_types = { | 489 self._mime_types = { |
490 'crx' : 'application/x-chrome-extension', | 490 'crx' : 'application/x-chrome-extension', |
491 'exe' : 'application/octet-stream', | 491 'exe' : 'application/octet-stream', |
492 'gif': 'image/gif', | 492 'gif': 'image/gif', |
493 'jpeg' : 'image/jpeg', | 493 'jpeg' : 'image/jpeg', |
494 'jpg' : 'image/jpeg', | 494 'jpg' : 'image/jpeg', |
495 'json': 'application/json', | 495 'json': 'application/json', |
496 'pdf' : 'application/pdf', | 496 'pdf' : 'application/pdf', |
| 497 'wav' : 'audio/wav', |
497 'xml' : 'text/xml' | 498 'xml' : 'text/xml' |
498 } | 499 } |
499 self._default_mime_type = 'text/html' | 500 self._default_mime_type = 'text/html' |
500 | 501 |
501 BasePageHandler.__init__(self, request, client_address, socket_server, | 502 BasePageHandler.__init__(self, request, client_address, socket_server, |
502 connect_handlers, get_handlers, head_handlers, | 503 connect_handlers, get_handlers, head_handlers, |
503 post_handlers, put_handlers) | 504 post_handlers, put_handlers) |
504 | 505 |
505 def GetMIMETypeFromName(self, file_name): | 506 def GetMIMETypeFromName(self, file_name): |
506 """Returns the mime type for the specified file_name. So far it only looks | 507 """Returns the mime type for the specified file_name. So far it only looks |
(...skipping 1935 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
2442 'load multipe keys into the server. If the ' | 2443 'load multipe keys into the server. If the ' |
2443 'server has multiple keys, it will rotate ' | 2444 'server has multiple keys, it will rotate ' |
2444 'through them in at each request a ' | 2445 'through them in at each request a ' |
2445 'round-robin fashion. The server will ' | 2446 'round-robin fashion. The server will ' |
2446 'generate a random key if none is specified ' | 2447 'generate a random key if none is specified ' |
2447 'on the command line.') | 2448 'on the command line.') |
2448 | 2449 |
2449 | 2450 |
2450 if __name__ == '__main__': | 2451 if __name__ == '__main__': |
2451 sys.exit(ServerRunner().main()) | 2452 sys.exit(ServerRunner().main()) |
OLD | NEW |