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
…GH-17851) (#17854)

(cherry picked from commit ee94bdb)

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

Co-authored-by: Jason R. Coombs <jaraco@jaraco.com>
  • Loading branch information
miss-islington and jaraco committed Jan 6, 2020
1 parent 5a065ac commit 5ed9d60
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 @@ -1280,4 +1280,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 5ed9d60

Please sign in to comment.