Mercurial > hg
changeset 5970:f25070ecf334
hgweb: fixes to make hg serve prefix handling more robust
author | Michele Cella <michele.cella@gmail.com> |
---|---|
date | Tue, 22 Jan 2008 22:13:29 +0100 |
parents | 821fc5c0656c |
children | 6d5ecf824a65 |
files | mercurial/commands.py mercurial/hgweb/hgwebdir_mod.py mercurial/hgweb/server.py |
diffstat | 3 files changed, 13 insertions(+), 5 deletions(-) [+] |
line wrap: on
line diff
--- a/mercurial/commands.py Thu Jan 31 14:44:00 2008 -0600 +++ b/mercurial/commands.py Tue Jan 22 22:13:29 2008 +0100 @@ -2418,11 +2418,17 @@ if not ui.verbose: return + if self.httpd.prefix: + prefix = self.httpd.prefix.strip('/') + '/' + else: + prefix = '' + if self.httpd.port != 80: - ui.status(_('listening at http://%s:%d/\n') % - (self.httpd.addr, self.httpd.port)) + ui.status(_('listening at http://%s:%d/%s\n') % + (self.httpd.addr, self.httpd.port, prefix)) else: - ui.status(_('listening at http://%s/\n') % self.httpd.addr) + ui.status(_('listening at http://%s/%s\n') % + (self.httpd.addr, prefix)) def run(self): self.httpd.serve_forever()
--- a/mercurial/hgweb/hgwebdir_mod.py Thu Jan 31 14:44:00 2008 -0600 +++ b/mercurial/hgweb/hgwebdir_mod.py Tue Jan 22 22:13:29 2008 +0100 @@ -172,7 +172,7 @@ if u.configbool("web", "hidden", untrusted=True): continue - parts = [req.env['PATH_INFO'], name] + parts = [req.env['PATH_INFO'].strip('/'), name] if req.env['SCRIPT_NAME']: parts.insert(0, req.env['SCRIPT_NAME']) url = ('/'.join(parts).replace("//", "/")) + '/'
--- a/mercurial/hgweb/server.py Thu Jan 31 14:44:00 2008 -0600 +++ b/mercurial/hgweb/server.py Tue Jan 22 22:13:29 2008 +0100 @@ -206,7 +206,9 @@ myui = repo.ui address = myui.config("web", "address", "") port = int(myui.config("web", "port", 8000)) - prefix = myui.config("web", "prefix", "").rstrip("/") + prefix = myui.config("web", "prefix", "") + if prefix: + prefix = "/" + prefix.strip("/") use_ipv6 = myui.configbool("web", "ipv6") webdir_conf = myui.config("web", "webdir_conf") ssl_cert = myui.config("web", "certificate")