-
-
Notifications
You must be signed in to change notification settings - Fork 1k
Update IDNA encoding to 2008 spec #161
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
Conversation
sethmlarson
left a comment
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thanks for opening this @StephenBrown2! I've marked a few issues, I think we should look at how urrlib3 handles this case or explore using rfc3986.IRIReference to handle it for us.
|
Looks like rfc3986.IRIReference will in fact do exactly what we want, including handling colons in the authority. I've rebased on master to resolve the conflict with hsts... and switched to using Ref: convenience function - https://github.com/python-hyper/rfc3986/blob/df21c4b09078580c1cb10c728dc18c3111fcf603/src/rfc3986/api.py#L41 |
httpx/models.py
Outdated
| ) -> None: | ||
| if isinstance(url, rfc3986.uri.URIReference): | ||
| self.components = url | ||
| elif isinstance(url, rfc3986.iri.IRIReference): |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I don't think we should be exposing extra types as part of this pull request.
(In fact I don't think we should be exposing rfc3986.uri.URIReference as part of our public interface in the first place - it'd be much better if we could keep that as an internal implementation detail, in order to allow us to completely switch implementations if needed.)
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
See #170
|
I guess we might also choose to switch our dependency listing to That'd stop devs from having to do a "wait where are you actually using the |
sethmlarson
left a comment
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I rebased and removed a test case that's no longer valid due to interface changes.
|
Yas - good stuff! |
Resolves #150 and adds tests based on deviations from 2003 spec: https://unicode.org/reports/tr46/#Deviations
This also enables Unicode® Technical Standard #46 to normalize capital letters and such, and a test based on the example given in the module documentation.
Since the idna encode() function chokes on colons, I've split and rejoined the authority string and added to the tests to make sure the port stays as expected.