mirror of
https://github.com/python/cpython.git
synced 2025-10-09 16:34:44 +00:00
bpo-38907: In http.server script, restore binding to IPv4 on Windows. (GH-17851)
This commit is contained in:
parent
d6c08db853
commit
ee94bdb059
2 changed files with 14 additions and 1 deletions
|
@ -1282,4 +1282,16 @@ if __name__ == '__main__':
|
||||||
else:
|
else:
|
||||||
handler_class = partial(SimpleHTTPRequestHandler,
|
handler_class = partial(SimpleHTTPRequestHandler,
|
||||||
directory=args.directory)
|
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,
|
||||||
|
)
|
||||||
|
|
|
@ -0,0 +1 @@
|
||||||
|
In http.server script, restore binding to IPv4 on Windows.
|
Loading…
Add table
Add a link
Reference in a new issue