em-http-request
em-http-request copied to clipboard
Addressable::URI::InvalidURIError
I'm getting this error when passing an URL containing //?
instead of /?
. A very simple reproducer is
require 'em-http-request'
EventMachine.run do
value = "http://a.domain.it//?p1=v1&p2=v2"
http = EventMachine::HttpRequest.new(value).get
end
which gives me
/var/lib/gems/2.5.0/gems/addressable-2.7.0/lib/addressable/uri.rb:2449:in `validate':
Absolute URI missing hierarchical segment: 'http://?p1=v1&p2=v2'
Addressable::URI::InvalidURIError)
However testing the URL on https://www.freeformatter.com/url-parser-query-string-splitter.html gives me a correct URL.
A deeper investigation pointed out it is not an issue with em-http-request
, but with Addressable
, instead. I've opened an issue there: sporkmonger/addressable#390, with an even smaller reproducer. Sorry for the noise.
I'm re-opening this, since it looks like this is not an addressable issue. This code is causing an exception, while I would have expected it to work.
EventMachine::HttpRequest.new("http://mysite.com//?p1=v1&p2=v2").get
while
EventMachine::HttpRequest.new("http://mysite.com/?p1=v1&p2=v2").get
works (see the double slash).