comparison mercurial/hgweb/hgweb_mod.py @ 4867:8be7ba425621

Make {urlbase} work in templates when https is used.
author Wesley J. Landaker <wjl@icecavern.net>
date Tue, 10 Jul 2007 10:54:54 -0600
parents e21a0e12ff10
children 192cd95c2ba8
comparison
equal deleted inserted replaced
4866:1f3742217a76 4867:8be7ba425621
785 style = self.config("web", "style", "") 785 style = self.config("web", "style", "")
786 if req.form.has_key('style'): 786 if req.form.has_key('style'):
787 style = req.form['style'][0] 787 style = req.form['style'][0]
788 mapfile = style_map(self.templatepath, style) 788 mapfile = style_map(self.templatepath, style)
789 789
790 if req.env.get('HTTPS'):
791 proto = 'https'
792 default_port = "443"
793 else:
794 proto = 'http'
795 default_port = "80"
796
790 port = req.env["SERVER_PORT"] 797 port = req.env["SERVER_PORT"]
791 port = port != "80" and (":" + port) or "" 798 port = port != default_port and (":" + port) or ""
792 urlbase = 'http://%s%s' % (req.env['SERVER_NAME'], port) 799 urlbase = '%s://%s%s' % (proto, req.env['SERVER_NAME'], port)
793 staticurl = self.config("web", "staticurl") or req.url + 'static/' 800 staticurl = self.config("web", "staticurl") or req.url + 'static/'
794 if not staticurl.endswith('/'): 801 if not staticurl.endswith('/'):
795 staticurl += '/' 802 staticurl += '/'
796 803
797 if not self.reponame: 804 if not self.reponame: