summaryrefslogtreecommitdiffstats
path: root/Lib/http
diff options
context:
space:
mode:
authorLisa Roach <lisaroach14@gmail.com>2018-11-26 18:43:38 (GMT)
committerGitHub <noreply@github.com>2018-11-26 18:43:38 (GMT)
commit433433fa6d55091600ce88dd19206b3902e0a87d (patch)
tree568dab8c1adcc3e954f012b9b4ae13ac2f5578f6 /Lib/http
parent75e4699b31d1d88abad097ad13466c5c07711324 (diff)
downloadcpython-433433fa6d55091600ce88dd19206b3902e0a87d.zip
cpython-433433fa6d55091600ce88dd19206b3902e0a87d.tar.gz
cpython-433433fa6d55091600ce88dd19206b3902e0a87d.tar.bz2
Adds IPv6 support when invoking http.server directly. (GH-10595)
Diffstat (limited to 'Lib/http')
-rw-r--r--Lib/http/server.py3
1 files changed, 3 insertions, 0 deletions
diff --git a/Lib/http/server.py b/Lib/http/server.py
index ca2dd50..22d865f 100644
--- a/Lib/http/server.py
+++ b/Lib/http/server.py
@@ -1226,6 +1226,9 @@ def test(HandlerClass=BaseHTTPRequestHandler,
"""
server_address = (bind, port)
+ if ':' in bind:
+ ServerClass.address_family = socket.AF_INET6
+
HandlerClass.protocol_version = protocol
with ServerClass(server_address, HandlerClass) as httpd:
sa = httpd.socket.getsockname()