Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP

Loading…

Added support for proxy environment variables (http_proxy and https_proxy) #6

Open
wants to merge 2 commits into from

1 participant

@mfojtik

Enable support for proxyfied environments to use AWS gem:

export https_proxy="10.0.0.1:3128"

Initiate request via AWS gem and you should see:

I, [2011-06-03T13:58:01.873547 #30152] INFO -- : New Aws::Ec2 using per_thread-connection mode
I, [2011-06-03T13:58:01.874218 #30152] INFO -- : Opening new HTTPS connection to ec2.us-east-1.amazonaws.com:443
I, [2011-06-03T13:58:01.874404 #30152] INFO -- : Using 10.34.37.122:3128 proxy for connection

PS: Sorry for a new pull request, I had a typo in https ;-)

@mfojtik

any chance to pull this and bump gem version? :)

@mfojtik

ping?

@mfojtik

ping #2 ? :-)

@mfojtik

this typo was resolved in the next commit.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
This page is out of date. Refresh to see the latest.
Showing with 14 additions and 0 deletions.
  1. +14 −0 lib/right_http_connection.rb
View
14 lib/right_http_connection.rb
@@ -278,6 +278,20 @@ def start(request_params)
@logger.info("Opening new #{@protocol.upcase} connection to #@server:#@port")
@http = Net::HTTP.new(@server, @port)
+
+ # Support HTTP and HTTPS proxies
+ if @protocol == "https" && ENV['https_proxy']
+ proxy_host, proxy_port = ENV['https_proxy'].gsub(/^http(s?):\/\//, '').split(':')
+ @http = Net::HTTP::Proxy(proxy_host, proxy_port).new(@server, @port)
+ @logger.info("Using #{proxy_host}:#{proxy_port} proxy for connection")
+ end
+
+ if @protocol == "http" && ENV['http_proxy']
+ proxy_host, proxy_port = ENV['http_proxy'].gsub(/^http(s?):\/\//, '').split(':')
+ @http = Net::HTTP::Proxy(proxy_host, proxy_port).new(@server, @port)
+ @logger.info("Using #{proxy_host}:#{proxy_port} proxy for connection")
+ end
+
@http.open_timeout = @params[:http_connection_open_timeout]
@http.read_timeout = @params[:http_connection_read_timeout]
Something went wrong with that request. Please try again.