You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
Repository navigation
HTTP::Request#headline raises InvalidURIError when path is equal to // #389
I've encountered InvalidURIError error when dealing with the redirects to a location with // path. (e.g. https://google.com//).
After further investigation, I realized that HTTP doesn't allow to make a request to such urls at all.
The crux of the matter is HTTP::Request#headline method that uses Addressable::URI#omit method to get the path + query portion of the given url.
And while addressable allows to parse such urls http://google.com// and most of the methods work as expected, it fails with InvalidURIError when uri.omit(:authority) is called.
HTTP.get("https://google.com//")#Addressable::URI::InvalidURIError: Cannot have a path with two leading slashes without anauthority set: '//'
Reproducing with Addressable directly:
# Parse url with // pathurl=Addressable::URI.parse("https://google.com//")# Check that it works as expectedurl.path == "//"# Try to remove authorityurl.omit(:authority)# raises InvalidURIError
I was going to submit this issue to the addressable repository at first, but after the consideration I think that it's primarily the bug in HTTP.
Because Addressable is following the spec that disallows path with two leading slashes without the authority.
Activity
ixti commentedon Dec 4, 2017
Hmm... @httprb/core I guess I agree. Probably we should "fix" this on our end. Something like: