mirror of
https://github.com/OpenNebula/one.git
synced 2026-11-21 04:12:37 +09:00
appmarket: Add proxy support for appmarket client
This commit is contained in:
1 parent
a1987c3a3f
commit
499a3f24f0
1 file changed
+13
-4
@@ -26,29 +26,38 @@ module Market
|
||||
@uri = URI.parse(url)
|
||||
|
||||
@user_agent = "OpenNebula #{CloudClient::VERSION} (#{user_agent})"
|
||||
|
||||
@host = nil
|
||||
@port = nil
|
||||
|
||||
if ENV['http_proxy']
|
||||
uri_proxy = URI.parse(ENV['http_proxy'])
|
||||
@host = uri_proxy.host
|
||||
@port = uri_proxy.port
|
||||
end
|
||||
end
|
||||
|
||||
def get(path)
|
||||
req = Net::HTTP::Get.new(path)
|
||||
req = Net::HTTP::Proxy(@host, @port)::Get.new(path)
|
||||
|
||||
do_request(req)
|
||||
end
|
||||
|
||||
def delete(path)
|
||||
req = Net::HTTP::Delete.new(path)
|
||||
req = Net::HTTP::Proxy(@host, @port)::Delete.new(path)
|
||||
|
||||
do_request(req)
|
||||
end
|
||||
|
||||
def post(path, body)
|
||||
req = Net::HTTP::Post.new(path)
|
||||
req = Net::HTTP::Proxy(@host, @port)::Post.new(path)
|
||||
req.body = body
|
||||
|
||||
do_request(req)
|
||||
end
|
||||
|
||||
def put(path, body)
|
||||
req = Net::HTTP::Put.new(path)
|
||||
req = Net::HTTP::Proxy(@host, @port)::Put.new(path)
|
||||
req.body = body
|
||||
|
||||
do_request(req)
|
||||
|
||||
Reference in new issue
Block a user