Conversation
(cherry picked from commit ccf218a) # Conflicts: # tests/test_connector.py
bdraco
marked this pull request as ready for review
June 7, 2026 03:05
Codecov Report✅ All modified and coverable lines are covered by tests. Additional details and impacted files@@ Coverage Diff @@
## 3.15 #12850 +/- ##
=======================================
Coverage 98.21% 98.21%
=======================================
Files 135 135
Lines 47969 48018 +49
Branches 2567 2576 +9
=======================================
+ Hits 47111 47161 +50
Misses 678 678
+ Partials 180 179 -1
Flags with carried forward coverage won't be shown. Click here to find out more. ☔ View full report in Codecov by Harness. |
Merging this PR will not alter performance
Comparing Footnotes
|
bdraco
deleted the
patchback/backports/3.15/ccf218ab8c319faf166aff4d4c04f969fed7e341/pr-12827
branch
June 7, 2026 05:29
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
This is a backport of PR #12827 as merged into master (ccf218a).
What do these changes do?
is_ip_address()treats any digit-and-dot host as an IP literal, soTCPConnector._resolve_host()treated legacy numeric forms like2130706433,017700000001and127.1as IP literals and handed the raw string straight to the socket layer instead of the configured resolver.This adds
is_canonical_ipv4_address(), which accepts only a standard dotted-quad with four decimal octets in range and no leading zeros, cross-checked againstipaddress.IPv4Addressover a broad corpus._resolve_host()now treats only canonical IPv4 literals (and IPv6) as IP addresses; any other numeric form is rejected withInvalidUrlClientError, and every non-literal host goes through the configured resolver as before.Are there changes in behavior for the user?
A request to a non-canonical numeric IPv4 host now raises
InvalidUrlClientErrorinstead of being treated as an IP literal. Canonical dotted-quad addresses, IPv6 literals, and ordinary hostnames are unchanged.Is it a substantial burden for the maintainers to support this?
No.
Related issue number
N/A
Checklist
CONTRIBUTORS.txtN/A, already listedCHANGES/folder