Make hg serve set the wsgi.url_scheme property correctly.
This fixes the bug where hg serve with SSL will always detect the wrong
urlbase for templates. This is also part of unifying the CGI interface
and hg serve interface to both use standard wsgi.
--- a/mercurial/hgweb/server.py Thu Jul 12 13:55:20 2007 -0600
+++ b/mercurial/hgweb/server.py Thu Jul 12 13:58:36 2007 -0600
@@ -37,6 +37,9 @@
self.handler.log_error("HG error: %s", msg)
class _hgwebhandler(object, BaseHTTPServer.BaseHTTPRequestHandler):
+
+ url_scheme = 'http'
+
def __init__(self, *args, **kargs):
self.protocol_version = 'HTTP/1.1'
BaseHTTPServer.BaseHTTPRequestHandler.__init__(self, *args, **kargs)
@@ -104,7 +107,7 @@
env[hkey] = hval
env['SERVER_PROTOCOL'] = self.request_version
env['wsgi.version'] = (1, 0)
- env['wsgi.url_scheme'] = 'http'
+ env['wsgi.url_scheme'] = type(self).url_scheme
env['wsgi.input'] = self.rfile
env['wsgi.errors'] = _error_logger(self)
env['wsgi.multithread'] = isinstance(self.server,
@@ -168,6 +171,9 @@
self.wfile.flush()
class _shgwebhandler(_hgwebhandler):
+
+ url_scheme = 'https'
+
def setup(self):
self.connection = self.request
self.rfile = socket._fileobject(self.request, "rb", self.rbufsize)