Skip to content

Instantly share code, notes, and snippets.

@barelyknown
Created January 20, 2013 23:43
Show Gist options
  • Select an option

  • Save barelyknown/4582632 to your computer and use it in GitHub Desktop.

Select an option

Save barelyknown/4582632 to your computer and use it in GitHub Desktop.
HTTP request through a proxy in ruby
http_class = Net::HTTP::Proxy(proxy_url, proxy_port, proxy_user, proxy_password)
http_class.start("example.com", 80) do |http|
request = Net::HTTP::Get.new "/hello_world.html"
request["Example-Header"] = "patriots_will_win_by_14"
http.request(request).body
end
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment