bpo-38907: In http.server script, restore binding to IPv4 on Windows. (GH-17851) (#17854)

(cherry picked from commit ee94bdb059)

Co-authored-by: Jason R. Coombs <jaraco@jaraco.com>

Co-authored-by: Jason R. Coombs <jaraco@jaraco.com>
This commit is contained in:
Miss Islington (bot) 2020-01-06 04:34:10 -08:00 committed by Jason R. Coombs
parent 5a065ac181
commit 5ed9d60bc5
2 changed files with 14 additions and 1 deletions

View File

@ -1280,4 +1280,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,
)

View File

@ -0,0 +1 @@
In http.server script, restore binding to IPv4 on Windows.