Show More
@@ -159,7 +159,8 b' class requestcontext(object):' | |||
|
159 | 159 | urlbase = r'%s://%s%s' % (proto, req.env[r'SERVER_NAME'], port) |
|
160 | 160 | logourl = self.config('web', 'logourl') |
|
161 | 161 | logoimg = self.config('web', 'logoimg') |
|
162 |
staticurl = self.config('web', 'staticurl') |
|
|
162 | staticurl = (self.config('web', 'staticurl') | |
|
163 | or pycompat.sysbytes(req.url) + 'static/') | |
|
163 | 164 | if not staticurl.endswith('/'): |
|
164 | 165 | staticurl += '/' |
|
165 | 166 | |
@@ -182,7 +183,7 b' class requestcontext(object):' | |||
|
182 | 183 | if not self.reponame: |
|
183 | 184 | self.reponame = (self.config('web', 'name', '') |
|
184 | 185 | or req.env.get('REPO_NAME') |
|
185 | or req.url.strip('/') or self.repo.root) | |
|
186 | or req.url.strip(r'/') or self.repo.root) | |
|
186 | 187 | |
|
187 | 188 | def websubfilter(text): |
|
188 | 189 | return templatefilters.websub(text, self.websubtable) |
@@ -190,7 +191,7 b' class requestcontext(object):' | |||
|
190 | 191 | # create the templater |
|
191 | 192 | # TODO: export all keywords: defaults = templatekw.keywords.copy() |
|
192 | 193 | defaults = { |
|
193 | 'url': req.url, | |
|
194 | 'url': pycompat.sysbytes(req.url), | |
|
194 | 195 | 'logourl': logourl, |
|
195 | 196 | 'logoimg': logoimg, |
|
196 | 197 | 'staticurl': staticurl, |
@@ -199,7 +200,7 b' class requestcontext(object):' | |||
|
199 | 200 | 'encoding': encoding.encoding, |
|
200 | 201 | 'motd': motd, |
|
201 | 202 | 'sessionvars': sessionvars, |
|
202 | 'pathdef': makebreadcrumb(req.url), | |
|
203 | 'pathdef': makebreadcrumb(pycompat.sysbytes(req.url)), | |
|
203 | 204 | 'style': style, |
|
204 | 205 | 'nonce': self.nonce, |
|
205 | 206 | } |
@@ -333,17 +334,17 b' class hgweb(object):' | |||
|
333 | 334 | # use SCRIPT_NAME, PATH_INFO and QUERY_STRING as well as our REPO_NAME |
|
334 | 335 | |
|
335 | 336 | req.url = req.env[r'SCRIPT_NAME'] |
|
336 | if not req.url.endswith('/'): | |
|
337 | req.url += '/' | |
|
337 | if not req.url.endswith(r'/'): | |
|
338 | req.url += r'/' | |
|
338 | 339 | if req.env.get('REPO_NAME'): |
|
339 | 340 | req.url += req.env[r'REPO_NAME'] + r'/' |
|
340 | 341 | |
|
341 | 342 | if r'PATH_INFO' in req.env: |
|
342 | parts = req.env[r'PATH_INFO'].strip('/').split('/') | |
|
343 | parts = req.env[r'PATH_INFO'].strip(r'/').split(r'/') | |
|
343 | 344 | repo_parts = req.env.get(r'REPO_NAME', r'').split(r'/') |
|
344 | 345 | if parts[:len(repo_parts)] == repo_parts: |
|
345 | 346 | parts = parts[len(repo_parts):] |
|
346 | query = '/'.join(parts) | |
|
347 | query = r'/'.join(parts) | |
|
347 | 348 | else: |
|
348 | 349 | query = req.env[r'QUERY_STRING'].partition(r'&')[0] |
|
349 | 350 | query = query.partition(r';')[0] |
@@ -364,7 +365,7 b' class hgweb(object):' | |||
|
364 | 365 | |
|
365 | 366 | # translate user-visible url structure to internal structure |
|
366 | 367 | |
|
367 | args = query.split('/', 2) | |
|
368 | args = query.split(r'/', 2) | |
|
368 | 369 | if 'cmd' not in req.form and args and args[0]: |
|
369 | 370 | cmd = args.pop(0) |
|
370 | 371 | style = cmd.rfind('-') |
@@ -124,8 +124,8 b' class _httprequesthandler(httpservermod.' | |||
|
124 | 124 | env[r'SERVER_NAME'] = self.server.server_name |
|
125 | 125 | env[r'SERVER_PORT'] = str(self.server.server_port) |
|
126 | 126 | env[r'REQUEST_URI'] = self.path |
|
127 | env[r'SCRIPT_NAME'] = self.server.prefix | |
|
128 | env[r'PATH_INFO'] = path[len(self.server.prefix):] | |
|
127 | env[r'SCRIPT_NAME'] = pycompat.sysstr(self.server.prefix) | |
|
128 | env[r'PATH_INFO'] = pycompat.sysstr(path[len(self.server.prefix):]) | |
|
129 | 129 | env[r'REMOTE_HOST'] = self.client_address[0] |
|
130 | 130 | env[r'REMOTE_ADDR'] = self.client_address[0] |
|
131 | 131 | if query: |
@@ -154,7 +154,7 b' class _httprequesthandler(httpservermod.' | |||
|
154 | 154 | env[hkey] = hval |
|
155 | 155 | env[r'SERVER_PROTOCOL'] = self.request_version |
|
156 | 156 | env[r'wsgi.version'] = (1, 0) |
|
157 | env[r'wsgi.url_scheme'] = self.url_scheme | |
|
157 | env[r'wsgi.url_scheme'] = pycompat.sysstr(self.url_scheme) | |
|
158 | 158 | if env.get(r'HTTP_EXPECT', '').lower() == '100-continue': |
|
159 | 159 | self.rfile = common.continuereader(self.rfile, self.wfile.write) |
|
160 | 160 |
General Comments 0
You need to be logged in to leave comments.
Login now