bpo-35545: Fix mishandling of scoped IPv6 addresses#11403
bpo-35545: Fix mishandling of scoped IPv6 addresses#11403twisteroidambassador wants to merge 3 commits into
Conversation
High-level APIs such as create_connection() accept (host, port), while low-level APIs such as sock_connect() accept socket address tuples. _ensure_resolved() should be used exactly once to turn (host, port) into an address tuple. The signature of _ensure_resolved() was changed from (address, *, ...) to (host, port, *, ...) to enforce this.
|
@asvetlov please review. |
|
@1st1, is this PR still needed since the other one for the issue was merged? Thanks! |
|
I'm not sure. @ @twisteroidambassador do we still need this one? Do you want it in 3.9beta 2? |
|
Most likely this PR is not needed anymore. This PR is associated with 2 issues, bpo-33678 and bpo-35545. bpo-35545 has two PRs, and that issue has been fixed with the other PR #11271 that got merged. (That PR went in a completely different direction from this one. The root cause of bpo-35545 is that, when a pre-resolved link-local IPv6 addresses pass through _ensure_resolved() again, information is lost. My idea is to make sure an address never passes through _ensure_resolved() more than once. I still think this is the cleaner approach, but it is a breaking change, because it means sock_connect() no longer accepts all (host, port), but must take a pre-resolved address. #11271 instead made sure that _ensure_resolved() does not lose information, so it fixed the issue in a backward-compatible way.) bpo-33678 is not fixed yet. This PR would fix it as a side effect, but since we already went with #11271 for bpo-35545, I don't think we should merge this one just for bpo-33678. Instead, I think bpo-33678 can be fixed in a minimally-intrusive way as suggested by the first comment there, basically changing this line: cpython/Lib/asyncio/selector_events.py Lines 488 to 489 in f7b1e46 To: |
|
Do you want to close this PR and submit a new one? |
|
I don't have time to make a new PR lately, but I agree to close this one. |
Make sure _ensure_resolved() is only called on user-provided (host, port), and not on already-resolved socket address tuples.
This should also fix bpo-33678.
https://bugs.python.org/issue35545