Created
June 30, 2011 09:08
-
-
Save smallstyle/1055901 to your computer and use it in GitHub Desktop.
use proxy in heroku logs
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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