comparison mercurial/hgweb/hgwebdir_mod.py @ 5579:e15f7db0f0ee

Use SCRIPT_NAME and PATH_INFO instead of REQUEST_URI. This is required by WSGI (fixes issue846).
author Dirkjan Ochtman <dirkjan@ochtman.nl>
date Sat, 01 Dec 2007 19:19:08 +0100
parents d74fc8dec2b4
children b34028d52e7e
comparison
equal deleted inserted replaced
5578:733b50883f73 5579:e15f7db0f0ee
89 interactive=False) 89 interactive=False)
90 90
91 def config(section, name, default=None, untrusted=True): 91 def config(section, name, default=None, untrusted=True):
92 return parentui.config(section, name, default, untrusted) 92 return parentui.config(section, name, default, untrusted)
93 93
94 url = req.env['REQUEST_URI'].split('?')[0] 94 url = req.env.get('SCRIPT_NAME', '')
95 if not url.endswith('/'): 95 if not url.endswith('/'):
96 url += '/' 96 url += '/'
97 pathinfo = req.env.get('PATH_INFO', '').strip('/') + '/' 97
98 base = url[:len(url) - len(pathinfo)] 98 staticurl = config('web', 'staticurl') or url + 'static/'
99 if not base.endswith('/'):
100 base += '/'
101
102 staticurl = config('web', 'staticurl') or base + 'static/'
103 if not staticurl.endswith('/'): 99 if not staticurl.endswith('/'):
104 staticurl += '/' 100 staticurl += '/'
105 101
106 style = self.style 102 style = self.style
107 if style is None: 103 if style is None:
156 return u.config(section, name, default, untrusted=True) 152 return u.config(section, name, default, untrusted=True)
157 153
158 if u.configbool("web", "hidden", untrusted=True): 154 if u.configbool("web", "hidden", untrusted=True):
159 continue 155 continue
160 156
161 url = ('/'.join([req.env["REQUEST_URI"].split('?')[0], name]) 157 parts = [req.env['PATH_INFO'], name]
162 .replace("//", "/")) + '/' 158 if req.env['SCRIPT_NAME']:
159 parts.insert(0, req.env['SCRIPT_NAME'])
160 url = ('/'.join(parts).replace("//", "/")) + '/'
163 161
164 # update time with local timezone 162 # update time with local timezone
165 try: 163 try:
166 d = (get_mtime(path), util.makedate()[1]) 164 d = (get_mtime(path), util.makedate()[1])
167 except OSError: 165 except OSError: