##// END OF EJS Templates
hgweb: use computed base URL from parsed request...
Gregory Szorc -
r36825:1e2194e0 default
parent child Browse files
Show More
@@ -142,21 +142,9 b' class requestcontext(object):'
142 142 if typ in allowed or self.configbool('web', 'allow%s' % typ):
143 143 yield {'type': typ, 'extension': spec[2], 'node': nodeid}
144 144
145 def templater(self, wsgireq):
145 def templater(self, wsgireq, req):
146 146 # determine scheme, port and server name
147 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 148 logourl = self.config('web', 'logourl')
161 149 logoimg = self.config('web', 'logoimg')
162 150 staticurl = (self.config('web', 'staticurl')
@@ -194,7 +182,7 b' class requestcontext(object):'
194 182 'logourl': logourl,
195 183 'logoimg': logoimg,
196 184 'staticurl': staticurl,
197 'urlbase': urlbase,
185 'urlbase': req.advertisedbaseurl,
198 186 'repo': self.reponame,
199 187 'encoding': encoding.encoding,
200 188 'motd': motd,
@@ -396,7 +384,7 b' class hgweb(object):'
396 384 # process the web interface request
397 385
398 386 try:
399 tmpl = rctx.templater(wsgireq)
387 tmpl = rctx.templater(wsgireq, req)
400 388 ctype = tmpl('mimetype', encoding=encoding.encoding)
401 389 ctype = templater.stringify(ctype)
402 390
General Comments 0
You need to be logged in to leave comments. Login now