msg243317 - (view) |
Author: (Link Mauve) |
Date: 2015-05-16 13:54 |
When running `python -m http.server -b ::` (or any other IPv6), I’d expect people to be able to download from my IPv6. This patch fixes that issue. I also tested it on a dual-stack kernel, IPv4 requests work just fine and appear as ::ffff:127.0.0.1 for example. |
|
|
msg243883 - (view) |
Author: Martin Panter (martin.panter) *  |
Date: 2015-05-23 03:53 |
I am no IPv6 expert, but this looks like a reasonable first approximation. The “http.server” module documentation should also be updated to say IPv6 addresses are supported on the command line, and I guess there should be a test case added. But maybe see Lib/smtpd.py line 657 for how this is done in a more general way for the SMTP server module (Issue 14758), using getaddrinfo(). There is also Issue 20215 proposing to do something equivalent in the lower level “socketserver” module, which would probably make this change redundant. It would also be nice for it to bind to both IPv4 and IPv6 if possible, but that is apparently not easy to do cross platform; see Issue 3213. |
|
|
msg315853 - (view) |
Author: Jason R. Coombs (jaraco) *  |
Date: 2018-04-27 18:35 |
From what I can tell, there's not currently any tests for the behavior of `http.server` as a script, and that sounds like a non-trivial behavior to test. I agree documentation updates for this change are essential, but I'd suggest a test is too high a burden to ask for a change like this when there aren't already tests exercising the related functionality. |
|
|
msg330071 - (view) |
Author: Lisa Roach (lisroach) *  |
Date: 2018-11-19 02:54 |
Looks like the original author isn't around anymore (feel free to chime in if you are, Link!), so I went ahead and made a PR. I added a quick unit test, it's not much but more than nothing, plus updated the documentation. |
|
|
msg334897 - (view) |
Author: Jason R. Coombs (jaraco) *  |
Date: 2019-02-06 00:53 |
I don't believe the current patch as accepted has the right behaviors. First off, the default behavior, which indicates "all interfaces" only binds to IPv4 interfaces. Additionally, "-b localhost" only binds to IPv4 localhost. Ideally, the bind should happen on all stacks unless a specific stack is indicated. |
|
|
msg335020 - (view) |
Author: Jason R. Coombs (jaraco) *  |
Date: 2019-02-07 13:22 |
New changeset f289084c83190cc72db4a70c58f007ec62e75247 by Jason R. Coombs in branch 'master': bpo-24209: In http.server script, rely on getaddrinfo to bind to preferred address based on the bind parameter. (#11767) https://github.com/python/cpython/commit/f289084c83190cc72db4a70c58f007ec62e75247 |
|
|