Mercurial > hg
diff mercurial/hgweb/server.py @ 5835:bd34f0ac3cb0
adding "prefix" option to "hg serve" (command line and [web] section)
allows "hg serve" to serve from a different path than '/' (server root)
author | Michele Cella <michele.cella@gmail.com> |
---|---|
date | Wed, 09 Jan 2008 11:15:00 +0100 |
parents | 1b365c5723bc |
children | f25070ecf334 |
line wrap: on
line diff
--- a/mercurial/hgweb/server.py Tue Jan 08 21:12:30 2008 -0600 +++ b/mercurial/hgweb/server.py Wed Jan 09 11:15:00 2008 +0100 @@ -76,7 +76,7 @@ self.do_POST() def do_hgweb(self): - path_info, query = _splitURI(self.path) + path, query = _splitURI(self.path) env = {} env['GATEWAY_INTERFACE'] = 'CGI/1.1' @@ -84,8 +84,8 @@ env['SERVER_NAME'] = self.server.server_name env['SERVER_PORT'] = str(self.server.server_port) env['REQUEST_URI'] = self.path - env['SCRIPT_NAME'] = '' - env['PATH_INFO'] = path_info + env['SCRIPT_NAME'] = self.server.prefix + env['PATH_INFO'] = path[len(self.server.prefix):] env['REMOTE_HOST'] = self.client_address[0] env['REMOTE_ADDR'] = self.client_address[0] if query: @@ -206,6 +206,7 @@ myui = repo.ui address = myui.config("web", "address", "") port = int(myui.config("web", "port", 8000)) + prefix = myui.config("web", "prefix", "").rstrip("/") use_ipv6 = myui.configbool("web", "ipv6") webdir_conf = myui.config("web", "webdir_conf") ssl_cert = myui.config("web", "certificate") @@ -254,6 +255,7 @@ addr = socket.gethostname() self.addr, self.port = addr, port + self.prefix = prefix if ssl_cert: try: