Skip to content

Instantly share code, notes, and snippets.

@smallstyle
Created June 30, 2011 09:08
Show Gist options
  • Star 2 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save smallstyle/1055901 to your computer and use it in GitHub Desktop.
Save smallstyle/1055901 to your computer and use it in GitHub Desktop.
use proxy in heroku logs
diff --git a/lib/heroku/client.rb b/lib/heroku/client.rb
index 9080906..2cab092 100644
--- a/lib/heroku/client.rb
+++ b/lib/heroku/client.rb
@@ -376,8 +376,15 @@ Console sessions require an open dyno to use for execution.
puts get("/apps/#{app_name}/logs").to_s
else
uri = URI.parse(url);
- http = Net::HTTP.new(uri.host, uri.port)
+ http = nil
+ if ENV['HTTP_PROXY'] || ENV['http_proxy']
+ ( ENV['HTTP_PROXY'] || ENV['http_proxy'] ) =~ %r|http://(?:(.*):(.*)@)?(.*):(\d+)/?|
+ http = Net::HTTP::Proxy( $3, $4, $1, $2 ).new( uri.host, uri.port )
+ else
+ http = Net::HTTP.new(uri.host, uri.port)
+ end
+
if uri.scheme == 'https'
http.use_ssl = true
http.verify_mode = OpenSSL::SSL::VERIFY_NONE
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment