diff options
author | Senthil Kumaran <senthil@uthcode.com> | 2012-04-29 04:51:54 (GMT) |
---|---|---|
committer | Senthil Kumaran <senthil@uthcode.com> | 2012-04-29 04:51:54 (GMT) |
commit | 1aacba497bfb816d16dc39c09cae3ae17d6d74a2 (patch) | |
tree | f8d7bacfeecc341aa72df5546f09df14a5339ed0 /Lib/http/server.py | |
parent | 0ce1649674cdd9bc3351f9b98edc1ae3ce3162fa (diff) | |
download | cpython-1aacba497bfb816d16dc39c09cae3ae17d6d74a2.zip cpython-1aacba497bfb816d16dc39c09cae3ae17d6d74a2.tar.gz cpython-1aacba497bfb816d16dc39c09cae3ae17d6d74a2.tar.bz2 |
Fix Issue6085 - SimpleHTTPServer address_string to return client ip instead of client hostname
Diffstat (limited to 'Lib/http/server.py')
-rw-r--r-- | Lib/http/server.py | 13 |
1 files changed, 2 insertions, 11 deletions
diff --git a/Lib/http/server.py b/Lib/http/server.py index 18313cf..b6b2997 100644 --- a/Lib/http/server.py +++ b/Lib/http/server.py @@ -558,15 +558,9 @@ class BaseHTTPRequestHandler(socketserver.StreamRequestHandler): 'Jul', 'Aug', 'Sep', 'Oct', 'Nov', 'Dec'] def address_string(self): - """Return the client address formatted for logging. + """Return the client address.""" - This version looks up the full hostname using gethostbyaddr(), - and tries to find a name that contains at least one dot. - - """ - - host, port = self.client_address[:2] - return socket.getfqdn(host) + return self.client_address[0] # Essentially static class variables @@ -1040,9 +1034,6 @@ class CGIHTTPRequestHandler(SimpleHTTPRequestHandler): env['SCRIPT_NAME'] = scriptname if query: env['QUERY_STRING'] = query - host = self.address_string() - if host != self.client_address[0]: - env['REMOTE_HOST'] = host env['REMOTE_ADDR'] = self.client_address[0] authorization = self.headers.get("authorization") if authorization: |