Use '127.0.0.1' only on Mac; for other, sane platforms, use 'localhost'.

This commit is contained in:
Ka-Ping Yee 2001-03-02 05:58:17 +00:00
parent 228d80736c
commit db8ed1517f
1 changed files with 3 additions and 2 deletions

View File

@ -1142,8 +1142,9 @@ pydoc</strong> by Ka-Ping Yee &lt;ping@lfw.org&gt;</font></small></small>"""
class DocServer(BaseHTTPServer.HTTPServer):
def __init__(self, port, callback):
self.address = ('127.0.0.1', port)
self.url = 'http://127.0.0.1:%d/' % port
host = (sys.platform == 'mac') and '127.0.0.1' or 'localhost'
self.address = (host, port)
self.url = 'http://%s:%d/' % (host, port)
self.callback = callback
self.base.__init__(self, self.address, self.handler)