| OLD | NEW |
| 1 #!/usr/bin/python | 1 #!/usr/bin/python |
| 2 | 2 |
| 3 # Copyright (c) 2009-2010 The Chromium OS Authors. All rights reserved. | 3 # Copyright (c) 2009-2010 The Chromium OS Authors. All rights reserved. |
| 4 # Use of this source code is governed by a BSD-style license that can be | 4 # Use of this source code is governed by a BSD-style license that can be |
| 5 # found in the LICENSE file. | 5 # found in the LICENSE file. |
| 6 | 6 |
| 7 """A CherryPy-based webserver to host images and build packages.""" | 7 """A CherryPy-based webserver to host images and build packages.""" |
| 8 | 8 |
| 9 import cherrypy | 9 import cherrypy |
| 10 import optparse | 10 import optparse |
| (...skipping 12 matching lines...) Expand all Loading... |
| 23 | 23 |
| 24 def _GetConfig(options): | 24 def _GetConfig(options): |
| 25 """Returns the configuration for the devserver.""" | 25 """Returns the configuration for the devserver.""" |
| 26 base_config = { 'global': | 26 base_config = { 'global': |
| 27 { 'server.log_request_headers': True, | 27 { 'server.log_request_headers': True, |
| 28 'server.protocol_version': 'HTTP/1.1', | 28 'server.protocol_version': 'HTTP/1.1', |
| 29 'server.socket_host': '0.0.0.0', | 29 'server.socket_host': '0.0.0.0', |
| 30 'server.socket_port': int(options.port), | 30 'server.socket_port': int(options.port), |
| 31 'server.socket_timeout': 6000, | 31 'server.socket_timeout': 6000, |
| 32 'response.timeout': 6000, | 32 'response.timeout': 6000, |
| 33 'tools.staticdir.root': os.getcwd(), | 33 'tools.staticdir.root': |
| 34 os.path.dirname(os.path.abspath(sys.argv[0])), |
| 34 }, | 35 }, |
| 35 '/build': | 36 '/build': |
| 36 { | 37 { |
| 37 'response.timeout': 100000, | 38 'response.timeout': 100000, |
| 38 }, | 39 }, |
| 39 '/update': | 40 '/update': |
| 40 { | 41 { |
| 41 # Gets rid of cherrypy parsing post file for args. | 42 # Gets rid of cherrypy parsing post file for args. |
| 42 'request.process_request_body': False, | 43 'request.process_request_body': False, |
| 43 'response.timeout': 10000, | 44 'response.timeout': 10000, |
| (...skipping 170 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 214 # We don't run the dev server with this option. | 215 # We don't run the dev server with this option. |
| 215 if options.validate_factory_config: | 216 if options.validate_factory_config: |
| 216 sys.exit(0) | 217 sys.exit(0) |
| 217 elif options.pregenerate_update: | 218 elif options.pregenerate_update: |
| 218 if not updater.PreGenerateUpdate(): | 219 if not updater.PreGenerateUpdate(): |
| 219 sys.exit(1) | 220 sys.exit(1) |
| 220 | 221 |
| 221 # If the command line requested after setup, it's time to do it. | 222 # If the command line requested after setup, it's time to do it. |
| 222 if not options.exit: | 223 if not options.exit: |
| 223 cherrypy.quickstart(DevServerRoot(), config=_GetConfig(options)) | 224 cherrypy.quickstart(DevServerRoot(), config=_GetConfig(options)) |
| OLD | NEW |