-
-
Notifications
You must be signed in to change notification settings - Fork 2.1k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Fix building the URL in BaseRequest when the host contains a port or IPv6 address #9309
Conversation
Will need a test as well .. but super late here so I'll have to pickup tomorrow |
Codecov ReportAll modified and coverable lines are covered by tests ✅
✅ All tests successful. No failed tests found. Additional details and impacted files@@ Coverage Diff @@
## master #9309 +/- ##
=======================================
Coverage 98.55% 98.55%
=======================================
Files 107 107
Lines 34867 34872 +5
Branches 4134 4134
=======================================
+ Hits 34364 34369 +5
Misses 335 335
Partials 168 168
Flags with carried forward coverage won't be shown. Click here to find out more. ☔ View full report in Codecov by Sentry. |
It's even more messy because when it's cloned we use the host but host is the raw host in this case. Actually it's even the host subcomponent so calling .host is very inconsistent about what you actually get ... and if it's idna encoding it's probably wrong as well There aren't any tests for handling IPv6 hosts correctly either We also probably want to let yarl parse the raw host instead of using URL.build |
Maybe the simplest fix is to pass it as authority instead of host |
But that's really inefficient because it creates new split results and reparses it 4x Should fix that to use the same logic in new but will need a lot of tests |
New tests fail with the following on master before the fix
|
Backport to 3.10: 💚 backport PR created✅ Backport PR branch: Backported as #9318 🤖 @patchback |
Backport to 3.11: 💚 backport PR created✅ Backport PR branch: Backported as #9319 🤖 @patchback |
…t when the host contains a port or IPv6 address (#9319) Co-authored-by: J. Nick Koston <[email protected]> fixes #9307
…t when the host contains a port or IPv6 address (#9318) Co-authored-by: J. Nick Koston <[email protected]> fixes #9307
What do these changes do?
The port was incorrectly being passed in the
host
field toURL.build
when theHost
header included theport
Are there changes in behavior for the user?
Calling
BaseRequest.url
will not fail with yarl 1.13.0+ when thehost
header has a portIs it a substantial burden for the maintainers to support this?
no
Related issue number
fixes #9307