summaryrefslogtreecommitdiffstats
path: root/Lib/dos-8x3/basehttp.py
diff options
context:
space:
mode:
authorGuido van Rossum <guido@python.org>2000-09-01 19:25:51 (GMT)
committerGuido van Rossum <guido@python.org>2000-09-01 19:25:51 (GMT)
commit8d691c842289cf4453f282637765f07113a7cc17 (patch)
tree3a7819d53d7578cf728d3bcfecba7daebb6981db /Lib/dos-8x3/basehttp.py
parent29201d490511b2af863e07fdf5cb247fc9117c2f (diff)
downloadcpython-8d691c842289cf4453f282637765f07113a7cc17.zip
cpython-8d691c842289cf4453f282637765f07113a7cc17.tar.gz
cpython-8d691c842289cf4453f282637765f07113a7cc17.tar.bz2
The usual
Diffstat (limited to 'Lib/dos-8x3/basehttp.py')
-rwxr-xr-xLib/dos-8x3/basehttp.py26
1 files changed, 3 insertions, 23 deletions
diff --git a/Lib/dos-8x3/basehttp.py b/Lib/dos-8x3/basehttp.py
index ea5095a..49f8984 100755
--- a/Lib/dos-8x3/basehttp.py
+++ b/Lib/dos-8x3/basehttp.py
@@ -93,19 +93,7 @@ class HTTPServer(SocketServer.TCPServer):
"""Override server_bind to store the server name."""
SocketServer.TCPServer.server_bind(self)
host, port = self.socket.getsockname()
- if not host or host == '0.0.0.0':
- host = socket.gethostname()
- try:
- hostname, hostnames, hostaddrs = socket.gethostbyaddr(host)
- except socket.error:
- hostname = host
- else:
- if '.' not in hostname:
- for host in hostnames:
- if '.' in host:
- hostname = host
- break
- self.server_name = hostname
+ self.server_name = socket.getfqdn(host)
self.server_port = port
@@ -418,16 +406,8 @@ class BaseHTTPRequestHandler(SocketServer.StreamRequestHandler):
"""
- (host, port) = self.client_address
- try:
- name, names, addresses = socket.gethostbyaddr(host)
- except socket.error, msg:
- return host
- names.insert(0, name)
- for name in names:
- if '.' in name: return name
- return names[0]
-
+ host, port = self.client_address
+ return socket.getfqdn(host)
# Essentially static class variables