marketplace_client_proxy.patch
| marketplace_client.rb 2012-09-25 17:51:51.423715028 +0200 | ||
|---|---|---|
| 27 | 27 |
@uri = URI.parse(url) |
| 28 | 28 | |
| 29 | 29 |
@user_agent = "OpenNebula #{CloudClient::VERSION} (#{user_agent})"
|
| 30 |
@proxy = ENV['http_proxy'] ? URI.parse(ENV['http_proxy']) : OpenStruct.new |
|
| 30 | 31 |
end |
| 31 | 32 | |
| 32 | 33 |
def get(path) |
| 33 |
req = Net::HTTP::Get.new(path) |
|
| 34 | ||
| 34 |
req = Net::HTTP::Proxy(@proxy.host, @proxy.port)::Get.new(path) |
|
| 35 | 35 |
do_request(req) |
| 36 | 36 |
end |
| 37 | 37 | |
| 38 | 38 |
def post(path, body) |
| 39 |
req = Net::HTTP::Post.new(path) |
|
| 39 |
req = Net::HTTP::Proxy(@proxy.host, @proxy.port)::Post.new(path)
|
|
| 40 | 40 |
req.body = body |
| 41 | 41 | |
| 42 | 42 |
do_request(req) |