| OLD | NEW |
| 1 #!/bin/env python | 1 #!/bin/env python |
| 2 # Copyright (c) 2006-2008 The Chromium Authors. All rights reserved. | 2 # Copyright (c) 2006-2008 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 """A class to help start/stop the lighttpd server used by layout tests.""" | 6 """A class to help start/stop the lighttpd server used by layout tests.""" |
| 7 | 7 |
| 8 | 8 |
| 9 import logging | 9 import logging |
| 10 import optparse | 10 import optparse |
| (...skipping 97 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 108 f.write(('cgi.assign = ( ".cgi" => "/usr/bin/env",\n' | 108 f.write(('cgi.assign = ( ".cgi" => "/usr/bin/env",\n' |
| 109 ' ".pl" => "/usr/bin/env",\n' | 109 ' ".pl" => "/usr/bin/env",\n' |
| 110 ' ".asis" => "/bin/cat",\n' | 110 ' ".asis" => "/bin/cat",\n' |
| 111 ' ".php" => "%s" )\n\n') % | 111 ' ".php" => "%s" )\n\n') % |
| 112 platform_util.LigHTTPdPHPPath()) | 112 platform_util.LigHTTPdPHPPath()) |
| 113 | 113 |
| 114 # Setup log files | 114 # Setup log files |
| 115 f.write(('server.errorlog = "%s"\n' | 115 f.write(('server.errorlog = "%s"\n' |
| 116 'accesslog.filename = "%s"\n\n') % (error_log, access_log)) | 116 'accesslog.filename = "%s"\n\n') % (error_log, access_log)) |
| 117 | 117 |
| 118 # Setup upload folders. Upload folder is to hold temporary upload files |
| 119 # and also POST data. This is used to support XHR layout tests that does |
| 120 # POST. |
| 121 f.write(('server.upload-dirs = ( "%s" )\n\n') % (self._output_dir)) |
| 122 |
| 118 # dump out of virtual host config at the bottom. | 123 # dump out of virtual host config at the bottom. |
| 119 if self._port and self._root: | 124 if self._port and self._root: |
| 120 mappings = [{'port': self._port, 'docroot': self._root}] | 125 mappings = [{'port': self._port, 'docroot': self._root}] |
| 121 else: | 126 else: |
| 122 mappings = self.VIRTUALCONFIG | 127 mappings = self.VIRTUALCONFIG |
| 123 for mapping in mappings: | 128 for mapping in mappings: |
| 124 ssl_setup = '' | 129 ssl_setup = '' |
| 125 if 'sslcert' in mapping: | 130 if 'sslcert' in mapping: |
| 126 ssl_setup = (' ssl.engine = "enable"\n' | 131 ssl_setup = (' ssl.engine = "enable"\n' |
| 127 ' ssl.pemfile = "%s"\n' % mapping['sslcert']) | 132 ' ssl.pemfile = "%s"\n' % mapping['sslcert']) |
| (...skipping 94 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 222 else: | 227 else: |
| 223 if (options.root is None) != (options.port is None): | 228 if (options.root is None) != (options.port is None): |
| 224 raise 'Either port or root is missing (need both, or neither)' | 229 raise 'Either port or root is missing (need both, or neither)' |
| 225 httpd = Lighttpd(tempfile.gettempdir(), | 230 httpd = Lighttpd(tempfile.gettempdir(), |
| 226 port=options.port, | 231 port=options.port, |
| 227 root=options.root) | 232 root=options.root) |
| 228 if 'start' == options.server: | 233 if 'start' == options.server: |
| 229 httpd.Start() | 234 httpd.Start() |
| 230 else: | 235 else: |
| 231 httpd.Stop(force=True) | 236 httpd.Stop(force=True) |
| OLD | NEW |