I'm working with em-http, but I cannot get HTTPS(SSL) connection behind proxy. Here is my code.
require 'eventmachine'
require 'em-http'
url = "https://twitter.com/"
opts = {
:proxy => { :host => 'my.proxy', :port => 8080 }
}
EventMachine.run do
http = EventMachine::HttpRequest.new(url, opts).get
http.callback {
puts http.response
EventMachine.stop
}
end
This code works without errors, but it does nothing and does not quit from eventmachine main loop.
When I try it under conditions like below, my app can connect to the target.
- outside proxy / via HTTPS
- behind proxy / via HTTP
I can also get response using curl behind proxy.
curl "https://twitter.com/"
What's wrong with my code?