Forum: Ruby ruby proxy http headers

Posted by Sarek Mather (mushini)
on 2012-12-23 01:23
How do I add headers to a proxy request using Net/Http?

proxy = Net::HTTP::Proxy(proxy_host, proxy_port)
proxy.start(url) { |http|
      res = http.get('/').body
      }



compared to:
req = Net::HTTP::Post.new(uri.request_uri)
req['Host']=$host
res = Net::HTTP.start(uri.hostname, uri.port) {|http|
      http.request(req)
      }
Please log in before posting. Registration is free and takes only a minute.
Existing account (Switch to SSL-encrypted connection)
NEW: Do you have a Google/GoogleMail or Yahoo account? No registration required!
Log in with Google account | Log in with Yahoo account
No account? Register here.