Hi folks,
I love EM, its performance is impressive. I'm coding on a distributed
harvester which uses few proxies. For me it's important to know which
request was sent via which proxy.But how to extract the proxy and
proxy port from the HTTP request? Didn't find any hint how to deal
with.
EventMachine.do
conn_opts = { :proxy => { :host => '1.2.3.4', :port => '8080' } }
request_opts = { :proxy => { :authorization => ['jdoe',
'mysecretpass'] } }
req = EventMachine::HttpRequest.new('
http://www.example.com',
conn_opts).get request_opts
req.callback {
proxy = how_to_retrieve_proxy_from_req ?
port = same_for_port
puts "Request to #{req.last_effective_url} was sent via proxy
#{proxy}, port #{port}"
}
end
Cheerio,
Chris