Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with
or
.
Download ZIP

Loading…

Add HTTP proxy support #66

Merged
merged 1 commit into from

2 participants

@yudai

I'd like to introduce HTTP proxy support to the current VMC.

This commit depends on the pull request below:

@cf-frontend

Hi yudai, thanks for the Pull Request. Looks like the Travis build only didn't go green because of the pull request it depends on. We've created a story for this in our backlog and will get back to it as soon as we've got the resources. If everything put together goes green for us we can probably merge it in. Thanks a lot and we'll keep you updated!

Dennis

@cf-frontend cf-frontend merged commit 04c577c into cloudfoundry-attic:master

1 check failed

Details default The Travis build failed
@cf-frontend

Released vmc 0.5.1.rc6 and cfoundry 0.5.3.rc7 which include your changes.

Thanks!

@yudai yudai referenced this pull request
Closed

Add https proxy support #71

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Commits on Mar 19, 2013
  1. @yudai

    Add HTTP proxy support

    yudai authored
This page is out of date. Refresh to see the latest.
Showing with 35 additions and 0 deletions.
  1. +4 −0 lib/vmc/cli.rb
  2. +31 −0 spec/vmc/cli_spec.rb
View
4 lib/vmc/cli.rb
@@ -29,6 +29,9 @@ class CLI < Mothership
option :proxy, :desc => "Run this command as another user (admin)", :alias => "-u",
:value => :email
+ option :http_proxy, :desc => "Connect though an http proxy server", :alias => "--http-proxy",
+ :value => :http_proxy
+
option :version, :desc => "Print version number", :alias => "-v",
:default => false
@@ -409,6 +412,7 @@ def client(target = client_target)
end
@@client.proxy = input[:proxy]
+ @@client.http_proxy = input[:http_proxy] || ENV['HTTP_PROXY'] || ENV['http_proxy'] || nil
@@client.trace = input[:trace]
uri = URI.parse(target)
View
31 spec/vmc/cli_spec.rb
@@ -431,6 +431,37 @@ def refresh_token
expect(context.client.proxy).to eq('foo@example.com')
end
end
+
+ context "when ENV['http_proxy'] is set" do
+ before { ENV['http_proxy'] = "http://lower.example.com:80" }
+ after { ENV.delete('http_proxy') }
+
+ it "uses the http proxy URI on the enviroenment" do
+ expect(context.client.http_proxy).to eq('http://lower.example.com:80')
+ end
+ end
+
+ context "when ENV['HTTP_PROXY'] is set" do
+ before { ENV['HTTP_PROXY'] = "http://upper.example.com:80" }
+ after { ENV.delete('HTTP_PROXY') }
+
+ it "uses the http proxy URI on the environement" do
+ expect(context.client.http_proxy).to eq('http://upper.example.com:80')
+ end
+ end
+
+ context "with a http proxy URI" do
+ before do
+ ENV['HTTP_PROXY'] = "http://should.be.overwritten.example.com:80"
+ stub(context).input { {:http_proxy => 'http://arg.example.com:80'} }
+ end
+ after { ENV.delete('HTTP_PROXY') }
+
+ it "uses the provided http proxy URI" do
+ expect(context.client.http_proxy).to eq('http://arg.example.com:80')
+ end
+ end
+
end
context "with a v2 cloud controller" do
Something went wrong with that request. Please try again.