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 340 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
351 head_handlers = [ | 351 head_handlers = [ |
352 self.FileHandler, | 352 self.FileHandler, |
353 self.DefaultResponseHandler] | 353 self.DefaultResponseHandler] |
354 | 354 |
355 self._mime_types = { | 355 self._mime_types = { |
356 'crx' : 'application/x-chrome-extension', | 356 'crx' : 'application/x-chrome-extension', |
357 'exe' : 'application/octet-stream', | 357 'exe' : 'application/octet-stream', |
358 'gif': 'image/gif', | 358 'gif': 'image/gif', |
359 'jpeg' : 'image/jpeg', | 359 'jpeg' : 'image/jpeg', |
360 'jpg' : 'image/jpeg', | 360 'jpg' : 'image/jpeg', |
| 361 'js' : 'application/javascript', |
361 'json': 'application/json', | 362 'json': 'application/json', |
362 'pdf' : 'application/pdf', | 363 'pdf' : 'application/pdf', |
363 'txt' : 'text/plain', | 364 'txt' : 'text/plain', |
364 'wav' : 'audio/wav', | 365 'wav' : 'audio/wav', |
365 'xml' : 'text/xml' | 366 'xml' : 'text/xml' |
366 } | 367 } |
367 self._default_mime_type = 'text/html' | 368 self._default_mime_type = 'text/html' |
368 | 369 |
369 testserver_base.BasePageHandler.__init__(self, request, client_address, | 370 testserver_base.BasePageHandler.__init__(self, request, client_address, |
370 socket_server, connect_handlers, | 371 socket_server, connect_handlers, |
(...skipping 1895 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
2266 self.option_parser.add_option('--file-root-url', default='/files/', | 2267 self.option_parser.add_option('--file-root-url', default='/files/', |
2267 help='Specify a root URL for files served.') | 2268 help='Specify a root URL for files served.') |
2268 # TODO(ricea): Generalize this to support basic auth for HTTP too. | 2269 # TODO(ricea): Generalize this to support basic auth for HTTP too. |
2269 self.option_parser.add_option('--ws-basic-auth', action='store_true', | 2270 self.option_parser.add_option('--ws-basic-auth', action='store_true', |
2270 dest='ws_basic_auth', | 2271 dest='ws_basic_auth', |
2271 help='Enable basic-auth for WebSocket') | 2272 help='Enable basic-auth for WebSocket') |
2272 | 2273 |
2273 | 2274 |
2274 if __name__ == '__main__': | 2275 if __name__ == '__main__': |
2275 sys.exit(ServerRunner().main()) | 2276 sys.exit(ServerRunner().main()) |
OLD | NEW |