Hi,
I'm opening a new bug, since the reproducer is different, but I guess it's related to #338. When I use this code
require 'em-http-request'
USER_AGENT = 'Ruby Net::HTTP MyAgent'
def connection_opts
{
proxy: {
host: 'hhh',
port: 'ppp',
authorization: ['uuu', 'ppp']
}
}
end
def http_get_opts
@http_get_opts ||= {
head: {
'User-Agent' => USER_AGENT
}
}
end
EventMachine.run do
http = EventMachine::HttpRequest.new("http://ip.address//", connection_opts).get(http_get_opts)
http.callback do
puts "Connection ok"
EventMachine.stop
end
http.errback do
puts "Connection failed"
EventMachine.stop
end
end
(please note the double slash after the ip address), I get a crash: Absolute URI missing hierarchical segment: 'http://' (Addressable::URI::InvalidURIError). However, if I use
def connection_opts
{}
end
everything is ok. I guess that somewhere in the code, the input URL is tokenized using // and passed to Addressable. When split/joined the resulting string is an invalid URL and addressable raises an exception.
Hi, I'm opening a new bug, since the reproducer is different, but I guess it's related to #338. When I use this code
(please note the double slash after the ip address), I get a crash:
Absolute URI missing hierarchical segment: 'http://' (Addressable::URI::InvalidURIError)
. However, if I useeverything is ok. I guess that somewhere in the code, the input URL is tokenized using
//
and passed toAddressable
. When split/joined the resulting string is an invalid URL and addressable raises an exception.