summaryrefslogtreecommitdiffstats
path: root/Lib/http/server.py
diff options
context:
space:
mode:
Diffstat (limited to 'Lib/http/server.py')
-rw-r--r--Lib/http/server.py14
1 files changed, 13 insertions, 1 deletions
diff --git a/Lib/http/server.py b/Lib/http/server.py
index 47a4fcf..b9a2717 100644
--- a/Lib/http/server.py
+++ b/Lib/http/server.py
@@ -1282,4 +1282,16 @@ if __name__ == '__main__':
else:
handler_class = partial(SimpleHTTPRequestHandler,
directory=args.directory)
- test(HandlerClass=handler_class, port=args.port, bind=args.bind)
+
+ # ensure dual-stack is not disabled; ref #38907
+ class DualStackServer(ThreadingHTTPServer):
+ def server_bind(self):
+ self.socket.setsockopt(socket.IPPROTO_IPV6, socket.IPV6_V6ONLY, 0)
+ return super().server_bind()
+
+ test(
+ HandlerClass=handler_class,
+ ServerClass=DualStackServer,
+ port=args.port,
+ bind=args.bind,
+ )