| Index: mojo/devtools/common/devtoolslib/http_server.py
|
| diff --git a/mojo/devtools/common/devtoolslib/http_server.py b/mojo/devtools/common/devtoolslib/http_server.py
|
| index 012a3f4f5943d5d711e166b2c806fd1ea143016e..edaaf061e23595275d54bb334bdf8598ca85a7fc 100644
|
| --- a/mojo/devtools/common/devtoolslib/http_server.py
|
| +++ b/mojo/devtools/common/devtoolslib/http_server.py
|
| @@ -126,12 +126,16 @@ def _GetHandlerClassForPath(base_path):
|
| return RequestHandler
|
|
|
|
|
| -def StartHttpServer(path):
|
| - """Starts an http server serving files from |path| on random
|
| - (system-allocated) port. Returns the server address.
|
| +def StartHttpServer(local_dir_path, host_port=0):
|
| + """Starts an http server serving files from |path| on |host_port|. Pass 0
|
| + as |host_port| to use a system-allocated port.
|
| +
|
| + Returns:
|
| + Tuple of the server address and the port on which it runs.
|
| """
|
| - assert path
|
| - httpd = _SilentTCPServer(('127.0.0.1', 0), _GetHandlerClassForPath(path))
|
| + assert local_dir_path
|
| + httpd = _SilentTCPServer(('127.0.0.1', host_port),
|
| + _GetHandlerClassForPath(local_dir_path))
|
| atexit.register(httpd.shutdown)
|
|
|
| http_thread = threading.Thread(target=httpd.serve_forever)
|
|
|