Show More
@@ -142,21 +142,9 b' class requestcontext(object):' | |||||
142 | if typ in allowed or self.configbool('web', 'allow%s' % typ): |
|
142 | if typ in allowed or self.configbool('web', 'allow%s' % typ): | |
143 | yield {'type': typ, 'extension': spec[2], 'node': nodeid} |
|
143 | yield {'type': typ, 'extension': spec[2], 'node': nodeid} | |
144 |
|
144 | |||
145 | def templater(self, wsgireq): |
|
145 | def templater(self, wsgireq, req): | |
146 | # determine scheme, port and server name |
|
146 | # determine scheme, port and server name | |
147 | # this is needed to create absolute urls |
|
147 | # this is needed to create absolute urls | |
148 |
|
||||
149 | proto = wsgireq.env.get('wsgi.url_scheme') |
|
|||
150 | if proto == 'https': |
|
|||
151 | proto = 'https' |
|
|||
152 | default_port = '443' |
|
|||
153 | else: |
|
|||
154 | proto = 'http' |
|
|||
155 | default_port = '80' |
|
|||
156 |
|
||||
157 | port = wsgireq.env[r'SERVER_PORT'] |
|
|||
158 | port = port != default_port and (r':' + port) or r'' |
|
|||
159 | urlbase = r'%s://%s%s' % (proto, wsgireq.env[r'SERVER_NAME'], port) |
|
|||
160 | logourl = self.config('web', 'logourl') |
|
148 | logourl = self.config('web', 'logourl') | |
161 | logoimg = self.config('web', 'logoimg') |
|
149 | logoimg = self.config('web', 'logoimg') | |
162 | staticurl = (self.config('web', 'staticurl') |
|
150 | staticurl = (self.config('web', 'staticurl') | |
@@ -194,7 +182,7 b' class requestcontext(object):' | |||||
194 | 'logourl': logourl, |
|
182 | 'logourl': logourl, | |
195 | 'logoimg': logoimg, |
|
183 | 'logoimg': logoimg, | |
196 | 'staticurl': staticurl, |
|
184 | 'staticurl': staticurl, | |
197 |
'urlbase': |
|
185 | 'urlbase': req.advertisedbaseurl, | |
198 | 'repo': self.reponame, |
|
186 | 'repo': self.reponame, | |
199 | 'encoding': encoding.encoding, |
|
187 | 'encoding': encoding.encoding, | |
200 | 'motd': motd, |
|
188 | 'motd': motd, | |
@@ -396,7 +384,7 b' class hgweb(object):' | |||||
396 | # process the web interface request |
|
384 | # process the web interface request | |
397 |
|
385 | |||
398 | try: |
|
386 | try: | |
399 | tmpl = rctx.templater(wsgireq) |
|
387 | tmpl = rctx.templater(wsgireq, req) | |
400 | ctype = tmpl('mimetype', encoding=encoding.encoding) |
|
388 | ctype = tmpl('mimetype', encoding=encoding.encoding) | |
401 | ctype = templater.stringify(ctype) |
|
389 | ctype = templater.stringify(ctype) | |
402 |
|
390 |
General Comments 0
You need to be logged in to leave comments.
Login now