mirror of
https://github.com/python/cpython.git
synced 2025-07-24 11:44:31 +00:00
Patch #744041: Use only first two elements of address to support IPv6.
This commit is contained in:
parent
40174c358f
commit
3c120debef
1 changed files with 2 additions and 2 deletions
|
@ -98,7 +98,7 @@ class HTTPServer(SocketServer.TCPServer):
|
|||
def server_bind(self):
|
||||
"""Override server_bind to store the server name."""
|
||||
SocketServer.TCPServer.server_bind(self)
|
||||
host, port = self.socket.getsockname()
|
||||
host, port = self.socket.getsockname()[:2]
|
||||
self.server_name = socket.getfqdn(host)
|
||||
self.server_port = port
|
||||
|
||||
|
@ -475,7 +475,7 @@ class BaseHTTPRequestHandler(SocketServer.StreamRequestHandler):
|
|||
|
||||
"""
|
||||
|
||||
host, port = self.client_address
|
||||
host, port = self.client_address[:2]
|
||||
return socket.getfqdn(host)
|
||||
|
||||
# Essentially static class variables
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue