Mercurial > hg
diff mercurial/hgweb/hgweb_mod.py @ 3274:e0cd1b98bf8d
hgweb: be more conservative about expanding SCRIPT_NAME
author | Brendan Cully <brendan@kublai.com> |
---|---|
date | Thu, 05 Oct 2006 15:36:53 -0700 |
parents | 10277edf7e5b |
children | db9d2a624521 |
line wrap: on
line diff
--- a/mercurial/hgweb/hgweb_mod.py Thu Oct 05 15:04:15 2006 -0700 +++ b/mercurial/hgweb/hgweb_mod.py Thu Oct 05 15:36:53 2006 -0700 @@ -653,13 +653,16 @@ def firstitem(query): return query.split('&', 1)[0].split(';', 1)[0] - root = req.env.get('SCRIPT_NAME', '') + root = req.env.get('REQUEST_URI', '').split('?', 1)[0] + pi = req.env.get('PATH_INFO', '') + if pi: + root = root[:-len(pi)] + if req.env.has_key('REPO_NAME'): base = '/' + req.env['REPO_NAME'] else: base = root - pi = req.env.get('PATH_INFO') if pi: while pi.startswith('//'): pi = pi[1:]