-
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
Dealing with non-ascii URIs (IRIs) in redirects #196
Milestone
Comments
Kinda sad this just doesn't work with stdlib I'm not opposed to using a gem if it has better handling of non-ASCII URIs. |
@tarcieri we can actually support Addressable when it's available. I mean do not depend on it directly, but provide different URI parser backends... |
Some kind of Multi-URI :D |
Oh, just realized (after reading mentioned SO thread), there's actually a solution: def normalize_uri(uri)
return uri if uri.is_a? URI
uri = uri.to_s
uri, *tail = uri.rpartition "#" if uri["#"]
URI(URI.encode(uri) << Array(tail).join)
end |
zanker
pushed a commit
to zanker/http.rb
that referenced
this issue
May 8, 2015
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
I'm running into problems when getting a URI that happens to redirect to a URI with non-ascii characters in it (an IRI from what I understand). A simple, repeatable case (in this case using http.rb 0.7.3 and Ruby 2.2.0) is:
Which results in this error:
From doing a bit of googling, it sounds like two possible solutions are to call URI.encode before URI.parse (which isn't foolproof...it will encode hash fragments for instance) or to use the addressable gem, neither of which seemed like great options for a PR. Is there a more reasonable solution?
The text was updated successfully, but these errors were encountered: