From ee94bdb0598f9bc47d6a49e58fffc97aa617be96 Mon Sep 17 00:00:00 2001 From: "Jason R. Coombs" Date: Sun, 5 Jan 2020 22:32:19 -0500 Subject: bpo-38907: In http.server script, restore binding to IPv4 on Windows. (GH-17851) --- Lib/http/server.py | 14 +++++++++++++- .../next/Library/2020-01-06-02-14-38.bpo-38907.F1RkCR.rst | 1 + 2 files changed, 14 insertions(+), 1 deletion(-) create mode 100644 Misc/NEWS.d/next/Library/2020-01-06-02-14-38.bpo-38907.F1RkCR.rst 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, + ) diff --git a/Misc/NEWS.d/next/Library/2020-01-06-02-14-38.bpo-38907.F1RkCR.rst b/Misc/NEWS.d/next/Library/2020-01-06-02-14-38.bpo-38907.F1RkCR.rst new file mode 100644 index 0000000..a6e79f7 --- /dev/null +++ b/Misc/NEWS.d/next/Library/2020-01-06-02-14-38.bpo-38907.F1RkCR.rst @@ -0,0 +1 @@ +In http.server script, restore binding to IPv4 on Windows. \ No newline at end of file -- cgit v0.12