This issue tracker has been migrated to GitHub, and is currently read-only.
For more information, see the GitHub FAQs in the Python's Developer Guide.

Author jaraco
Recipients Shane Smith, jaraco, xtreak
Date 2020-01-05.20:01:08
SpamBayes Score -1.0
Marked as misclassified Yes
Message-id <1578254468.89.0.654069632317.issue39211@roundup.psfhosted.org>
In-reply-to
Content
Indeed, if I apply this patch:

```
diff --git a/Lib/http/server.py b/Lib/http/server.py
index 47a4fcf9a6..de995ae4b9 100644
--- a/Lib/http/server.py
+++ b/Lib/http/server.py
@@ -1246,6 +1246,11 @@ def test(HandlerClass=BaseHTTPRequestHandler,
     """
     ServerClass.address_family, addr = _get_best_family(bind, port)
 
+    def server_bind(self, orig=ServerClass.server_bind):
+        self.socket.setsockopt(socket.IPPROTO_IPV6, socket.IPV6_V6ONLY, 0)
+        return orig(self)
+    ServerClass.server_bind = server_bind
+
     HandlerClass.protocol_version = protocol
     with ServerClass(addr, HandlerClass) as httpd:
         host, port = httpd.socket.getsockname()[:2]
```

And then run `python -m http.server`, it binds to `::` but responds on `127.0.0.1` on Windows:

```
~ # python -m http.server
Serving HTTP on :: port 8000 (http://[::]:8000/) ... 
::ffff:127.0.0.1 - - [05/Jan/2020 14:48:09] "GET / HTTP/1.1" 200 - 
```

I think the solution is to add a patch similar to that until Python has a socketserver that supports dual-stack binding. See related issues issue25667, issue20215, issue36208, issue17561, and issue38907.

In fact, since issue38907 captures more concretely what I believe is the main issue here, I'm going to use that issue to address the concern. If Windows is able to bind dual-stack to IPv6/IPv4, I believe that would address the compatibility concern raised herein.

I'm going to mark this as a duplicate, but if you believe there is another issue at play here, please don't hesitate to re-open or comment and I can.
History
Date User Action Args
2020-01-05 20:01:08jaracosetrecipients: + jaraco, Shane Smith, xtreak
2020-01-05 20:01:08jaracosetmessageid: <1578254468.89.0.654069632317.issue39211@roundup.psfhosted.org>
2020-01-05 20:01:08jaracolinkissue39211 messages
2020-01-05 20:01:08jaracocreate