-
Notifications
You must be signed in to change notification settings - Fork 321
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
Add support for non-ascii URIs #197
Conversation
# | ||
# @param [#to_s] uri | ||
# @return [::URI] | ||
def normalize_uri(uri) |
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.
Can we just use addressable
? I see in the comments on the issue it's mentioned, but I don't see a problem with adding a dependency on something that supports URIs more closely to the RFC. This workaround seems very ugly :(
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'm fine with a hard dependency on addressable
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.
Well, I'm 100% agree that this hack is ugly as .
And I'm OK with Addressable, but not as hard dependency.
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.
Why not?
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.
If we're going to support non-ASCII, we should fully support them imo. Eg, http://🚚.la
doesn't work for URI, while it does for Addressable.
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.
Although Addressable is absolutely awesome gem, it's about 1.7x slower on parsing URIs.
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.
Anyway, I guess I'm just trying to reject any changes today.. :D Need to go sleep! :D Will replace this patch with addressable based solution ;))
88d7cf9
to
48e7437
Compare
@httprb/owners thoughts? I would sneak this into 0.8.0 release. |
This seems ok to me |
The only thing I could see adding is a test with non-ascii characters in a URI. |
👍 I think I made the decision to replace |
FWIW, the relevant specs in the |
@digitalextremist Isn't this is enough? https://github.com/httprb/http.rb/pull/197/files#diff-3ef70b884bdcb4e458a8230f6a2b4fb8R81 I'm ok to add more examples though. |
We can add following URLs (real ones) to tests if you think that worth it: Both of above will lead to this page :D |
@ixti I think it's worth it! |
@digitalextremist OK. Will add later today. |
Extra points for incorporating the |
base.query = nil | ||
base.path = "" | ||
base.to_s | ||
uri.omit(:query, :path).to_s |
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 already like Addressable more than URI!
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.
:D
That was a good idea to test behavior on a real connection... |
Ouch. found the issue :D |
Resolves #196
TIL |
Ackkkk :(. I'm sure it's feasible, although I'm not sure how much it's reinventing the wheel ultimately. |
Moving to pure stdlib will require fair amount of work. But definitely possible. |
Resolves #196