comparison 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
comparison
equal deleted inserted replaced
3273:46188b9528ca 3274:e0cd1b98bf8d
651 651
652 def spliturl(req): 652 def spliturl(req):
653 def firstitem(query): 653 def firstitem(query):
654 return query.split('&', 1)[0].split(';', 1)[0] 654 return query.split('&', 1)[0].split(';', 1)[0]
655 655
656 root = req.env.get('SCRIPT_NAME', '') 656 root = req.env.get('REQUEST_URI', '').split('?', 1)[0]
657 pi = req.env.get('PATH_INFO', '')
658 if pi:
659 root = root[:-len(pi)]
660
657 if req.env.has_key('REPO_NAME'): 661 if req.env.has_key('REPO_NAME'):
658 base = '/' + req.env['REPO_NAME'] 662 base = '/' + req.env['REPO_NAME']
659 else: 663 else:
660 base = root 664 base = root
661 665
662 pi = req.env.get('PATH_INFO')
663 if pi: 666 if pi:
664 while pi.startswith('//'): 667 while pi.startswith('//'):
665 pi = pi[1:] 668 pi = pi[1:]
666 if pi.startswith(base): 669 if pi.startswith(base):
667 if len(pi) > len(base): 670 if len(pi) > len(base):