Skip to content

Commit

Permalink
bpo-38907: In http.server script, restore binding to IPv4 on Windows. (
Browse files Browse the repository at this point in the history
  • Loading branch information
jaraco authored and shihai1991 committed Jan 31, 2020
1 parent 39b8670 commit 74079cf
Show file tree
Hide file tree
Showing 2 changed files with 14 additions and 1 deletion.
14 changes: 13 additions & 1 deletion Lib/http/server.py
Original file line number Diff line number Diff line change
Expand Up @@ -1282,4 +1282,16 @@ def test(HandlerClass=BaseHTTPRequestHandler,
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,
)
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
In http.server script, restore binding to IPv4 on Windows.

0 comments on commit 74079cf

Please sign in to comment.