Mercurial > hg
diff mercurial/hgweb/server.py @ 29553:cd3e58862cab
hgweb: pass ui into preparehttpserver
Upcoming patches will need the built-in HTTPS server to be more
configurable.
author | Gregory Szorc <gregory.szorc@gmail.com> |
---|---|
date | Wed, 13 Jul 2016 00:14:50 -0700 |
parents | 33770d2b6cf9 |
children | 121d11814c62 |
line wrap: on
line diff
--- a/mercurial/hgweb/server.py Thu Jul 14 03:12:09 2016 -0700 +++ b/mercurial/hgweb/server.py Wed Jul 13 00:14:50 2016 -0700 @@ -58,7 +58,7 @@ url_scheme = 'http' @staticmethod - def preparehttpserver(httpserver, ssl_cert): + def preparehttpserver(httpserver, ui): """Prepare .socket of new HTTPServer instance""" pass @@ -222,15 +222,17 @@ url_scheme = 'https' @staticmethod - def preparehttpserver(httpserver, ssl_cert): + def preparehttpserver(httpserver, ui): try: import ssl ssl.wrap_socket except ImportError: raise error.Abort(_("SSL support is unavailable")) + + certfile = ui.config('web', 'certificate') httpserver.socket = ssl.wrap_socket( httpserver.socket, server_side=True, - certfile=ssl_cert, ssl_version=ssl.PROTOCOL_TLSv1) + certfile=certfile, ssl_version=ssl.PROTOCOL_TLSv1) def setup(self): self.connection = self.request @@ -264,7 +266,7 @@ self.daemon_threads = True self.application = app - handler.preparehttpserver(self, ui.config('web', 'certificate')) + handler.preparehttpserver(self, ui) prefix = ui.config('web', 'prefix', '') if prefix: