hg serve: don't lookup user-supplied names/addresses
authorMatt Mackall <mpm@selenic.com>
Sun, 10 Jun 2007 19:16:20 -0500
changeset 4534 121999244123
parent 4533 36abb07c79d4
child 4535 720ae5085ee3
hg serve: don't lookup user-supplied names/addresses
mercurial/hgweb/server.py
--- a/mercurial/hgweb/server.py	Sat Jun 09 13:25:54 2007 +0200
+++ b/mercurial/hgweb/server.py	Sun Jun 10 19:16:20 2007 -0500
@@ -216,14 +216,10 @@
                 return hgwebobj
             self.reqmaker = wsgiapplication(make_handler)
 
-            addr, port = self.socket.getsockname()[:2]
-            if addr in ('0.0.0.0', '::'):
+            addr = address
+            if addr in ('', '::'):
                 addr = socket.gethostname()
-            else:
-                try:
-                    addr = socket.gethostbyaddr(addr)[0]
-                except socket.error:
-                    pass
+
             self.addr, self.port = addr, port
 
     class IPv6HTTPServer(MercurialHTTPServer):