##// END OF EJS Templates
server: abstract setup of ipv6 vs. normal server
Dirkjan Ochtman -
r10641:dedf88fe default
parent child Browse files
Show More
@@ -218,7 +218,6 b' def create_server(ui, repo):'
218 myui = repo.ui
218 myui = repo.ui
219 address = myui.config("web", "address", "")
219 address = myui.config("web", "address", "")
220 port = int(myui.config("web", "port", 8000))
220 port = int(myui.config("web", "port", 8000))
221 use_ipv6 = myui.configbool("web", "ipv6")
222 webdir_conf = myui.config("web", "webdir_conf")
221 webdir_conf = myui.config("web", "webdir_conf")
223
222
224 if webdir_conf:
223 if webdir_conf:
@@ -280,14 +279,16 b' def create_server(ui, repo):'
280 else:
279 else:
281 handler = _hgwebhandler
280 handler = _hgwebhandler
282
281
282 if myui.configbool('web', 'ipv6'):
283 cls = IPv6HTTPServer
284 else:
285 cls = MercurialHTTPServer
286
283 # ugly hack due to python issue5853 (for threaded use)
287 # ugly hack due to python issue5853 (for threaded use)
284 import mimetypes; mimetypes.init()
288 import mimetypes; mimetypes.init()
285
289
286 try:
290 try:
287 if use_ipv6:
291 return cls(myui, (address, port), handler)
288 return IPv6HTTPServer(myui, (address, port), handler)
289 else:
290 return MercurialHTTPServer(myui, (address, port), handler)
291 except socket.error, inst:
292 except socket.error, inst:
292 raise util.Abort(_("cannot start server at '%s:%d': %s")
293 raise util.Abort(_("cannot start server at '%s:%d': %s")
293 % (address, port, inst.args[1]))
294 % (address, port, inst.args[1]))
General Comments 0
You need to be logged in to leave comments. Login now