diff options
author | Lisa Roach <lisaroach14@gmail.com> | 2018-11-26 10:43:38 -0800 |
---|---|---|
committer | GitHub <noreply@github.com> | 2018-11-26 10:43:38 -0800 |
commit | 433433fa6d55091600ce88dd19206b3902e0a87d (patch) | |
tree | 568dab8c1adcc3e954f012b9b4ae13ac2f5578f6 /Lib/http/server.py | |
parent | 75e4699b31d1d88abad097ad13466c5c07711324 (diff) | |
download | cpython-git-433433fa6d55091600ce88dd19206b3902e0a87d.tar.gz |
Adds IPv6 support when invoking http.server directly. (GH-10595)
Diffstat (limited to 'Lib/http/server.py')
-rw-r--r-- | Lib/http/server.py | 3 |
1 files changed, 3 insertions, 0 deletions
diff --git a/Lib/http/server.py b/Lib/http/server.py index ca2dd50739..22d865f2fd 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() |