classification
Title: http.server (command) fails to bind dual-stack on Windows
Type: enhancement Stage: resolved
Components: Library (Lib) Versions: Python 3.9, Python 3.8
process
Status: closed Resolution: fixed
Dependencies: Superseder:
Assigned To: Nosy List: jaraco, zkonge
Priority: normal Keywords: patch

Created on 2019-11-24 17:04 by zkonge, last changed 2020-01-06 13:30 by jaraco. This issue is now closed.

Pull Requests
URL Status Linked Edit
PR 17378 closed zkonge, 2019-11-25 16:47
PR 17851 merged jaraco, 2020-01-06 02:11
PR 17854 merged miss-islington, 2020-01-06 03:32
PR 17864 merged jaraco, 2020-01-06 12:35
PR 17865 merged miss-islington, 2020-01-06 12:59
Messages (8)
msg357399 - (view) Author: JIanqiu Tao (zkonge) * Date: 2019-11-24 17:04
In Python 3.8+, when we run the http.server in a PC that support IPv6, it will bind IPv6 socket normally. On Linux or some other platforms, it also bind IPv4, that's pretty good, but on Windows, it doesn't work and "--bind 0.0.0.0" have to be provided to make it works in IPv4 environment.
In another case, once someone only want the http.server provide service in IPv6 environment, but linux will still bind IPv4 socket automatically.

Could we add a argument such as "--ipv6-only" for http.server and open the support of Dual-Stack socket by default?
msg357401 - (view) Author: JIanqiu Tao (zkonge) * Date: 2019-11-24 17:50
"--no-dual-stack" seems to be a better argument name. "--ipv6-only" lead to ambiguity in a IPv4 only environment.
msg359378 - (view) Author: Jason R. Coombs (jaraco) * (Python committer) Date: 2020-01-05 20:03
In issue39211, I've done a good deal of investigation on this issue and confirmed your findings - on Windows, the server fails to bind dual stack on Windows, but instead binds IPV6ONLY. That needs to be fixed such that the default is to bind dual-stack. Adding dual-stack control is a new feature and should be considered separately.
msg359399 - (view) Author: Jason R. Coombs (jaraco) * (Python committer) Date: 2020-01-06 03:32
New changeset ee94bdb0598f9bc47d6a49e58fffc97aa617be96 by Jason R. Coombs in branch 'master':
bpo-38907: In http.server script, restore binding to IPv4 on Windows. (GH-17851)
https://github.com/python/cpython/commit/ee94bdb0598f9bc47d6a49e58fffc97aa617be96
msg359419 - (view) Author: Jason R. Coombs (jaraco) * (Python committer) Date: 2020-01-06 12:34
New changeset 5ed9d60bc53e2eb0a88f07d5afe5299acdc0b216 by Jason R. Coombs (Miss Islington (bot)) in branch '3.8':
bpo-38907: In http.server script, restore binding to IPv4 on Windows. (GH-17851) (#17854)
https://github.com/python/cpython/commit/5ed9d60bc53e2eb0a88f07d5afe5299acdc0b216
msg359422 - (view) Author: Jason R. Coombs (jaraco) * (Python committer) Date: 2020-01-06 12:59
New changeset 7cdc31a14c824000cbe8b487900c9826a33f6940 by Jason R. Coombs in branch 'master':
bpo-38907: Suppress any exception when attempting to set V6ONLY. (GH-17864)
https://github.com/python/cpython/commit/7cdc31a14c824000cbe8b487900c9826a33f6940
msg359424 - (view) Author: Jason R. Coombs (jaraco) * (Python committer) Date: 2020-01-06 13:28
New changeset 33cb4a62bf6848093b7a05c9794582d204798b1b by Jason R. Coombs (Miss Islington (bot)) in branch '3.8':
bpo-38907: Suppress any exception when attempting to set V6ONLY. (GH-17864) (GH-17865)
https://github.com/python/cpython/commit/33cb4a62bf6848093b7a05c9794582d204798b1b
msg359425 - (view) Author: Jason R. Coombs (jaraco) * (Python committer) Date: 2020-01-06 13:30
In PR 17378, we discussed and I believe the conclusion is that the fix in the other PR(s) is sufficient to address the deficiency.
History
Date User Action Args
2020-01-06 13:30:04jaracosetstatus: open -> closed
resolution: fixed
messages: + msg359425

stage: patch review -> resolved
2020-01-06 13:28:30jaracosetmessages: + msg359424
2020-01-06 12:59:49miss-islingtonsetpull_requests: + pull_request17282
2020-01-06 12:59:43jaracosetmessages: + msg359422
2020-01-06 12:35:21jaracosetpull_requests: + pull_request17281
2020-01-06 12:34:13jaracosetmessages: + msg359419
2020-01-06 03:32:34miss-islingtonsetpull_requests: + pull_request17275
2020-01-06 03:32:26jaracosetmessages: + msg359399
2020-01-06 02:11:41jaracosetpull_requests: + pull_request17272
2020-01-05 20:03:41jaracosetnosy: + jaraco

messages: + msg359378
title: Add IPv6 Dual-Stack control for http.server -> http.server (command) fails to bind dual-stack on Windows
2020-01-05 20:01:08jaracolinkissue39211 superseder
2019-11-25 16:47:51zkongesetkeywords: + patch
stage: patch review
pull_requests: + pull_request16860
2019-11-24 17:50:48zkongesetmessages: + msg357401
2019-11-24 17:04:10zkongecreate