# HG changeset patch # User Brendan Cully # Date 1160087813 25200 # Node ID e0cd1b98bf8dc6067d0a6db60c3688e08ec15e6b # Parent 46188b9528caf076fde67554f0b96833670474ba hgweb: be more conservative about expanding SCRIPT_NAME diff -r 46188b9528ca -r e0cd1b98bf8d mercurial/hgweb/hgweb_mod.py --- 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:]