mirror of
https://github.com/OpenNebula/one.git
synced 2025-03-21 14:50:08 +03:00
feature #1433: http proxy support for CloudClient.rb, contributed by Laurent Grawet
This commit is contained in:
parent
2685dc96d2
commit
c403a5b48e
@ -83,7 +83,8 @@ module CloudClient
|
||||
# is set if needed.
|
||||
# #########################################################################
|
||||
def self.http_start(url, timeout, &block)
|
||||
http = Net::HTTP.new(url.host, url.port)
|
||||
proxy = ENV['http_proxy'] ? URI.parse(ENV['http_proxy']) : OpenStruct.new
|
||||
http = Net::HTTP::Proxy(proxy.host, proxy.port).new(url.host, url.port)
|
||||
|
||||
if timeout
|
||||
http.read_timeout = timeout.to_i
|
||||
|
@ -27,16 +27,16 @@ module Market
|
||||
@uri = URI.parse(url)
|
||||
|
||||
@user_agent = "OpenNebula #{CloudClient::VERSION} (#{user_agent})"
|
||||
@proxy = ENV['http_proxy'] ? URI.parse(ENV['http_proxy']) : OpenStruct.new
|
||||
end
|
||||
|
||||
def get(path)
|
||||
req = Net::HTTP::Get.new(path)
|
||||
|
||||
req = Net::HTTP::Proxy(@proxy.host, @proxy.port)::Get.new(path)
|
||||
do_request(req)
|
||||
end
|
||||
|
||||
def post(path, body)
|
||||
req = Net::HTTP::Post.new(path)
|
||||
req = Net::HTTP::Proxy(@proxy.host, @proxy.port)::Post.new(path)
|
||||
req.body = body
|
||||
|
||||
do_request(req)
|
||||
|
Loading…
x
Reference in New Issue
Block a user