Mercurial > hg-stable
changeset 10641:dedf88fe945a
server: abstract setup of ipv6 vs. normal server
author | Dirkjan Ochtman <djc.ochtman@kentyde.com> |
---|---|
date | Thu, 11 Mar 2010 13:31:37 +0100 |
parents | 90a095c24bc4 |
children | 812b85d02c92 |
files | mercurial/hgweb/server.py |
diffstat | 1 files changed, 6 insertions(+), 5 deletions(-) [+] |
line wrap: on
line diff
--- a/mercurial/hgweb/server.py Thu Mar 11 13:30:52 2010 +0100 +++ b/mercurial/hgweb/server.py Thu Mar 11 13:31:37 2010 +0100 @@ -218,7 +218,6 @@ myui = repo.ui address = myui.config("web", "address", "") port = int(myui.config("web", "port", 8000)) - use_ipv6 = myui.configbool("web", "ipv6") webdir_conf = myui.config("web", "webdir_conf") if webdir_conf: @@ -280,14 +279,16 @@ else: handler = _hgwebhandler + if myui.configbool('web', 'ipv6'): + cls = IPv6HTTPServer + else: + cls = MercurialHTTPServer + # ugly hack due to python issue5853 (for threaded use) import mimetypes; mimetypes.init() try: - if use_ipv6: - return IPv6HTTPServer(myui, (address, port), handler) - else: - return MercurialHTTPServer(myui, (address, port), handler) + return cls(myui, (address, port), handler) except socket.error, inst: raise util.Abort(_("cannot start server at '%s:%d': %s") % (address, port, inst.args[1]))