10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
|
# File 'lib/cfoundry/rest_client.rb', line 10
def self.create(uri, http_proxy, https_proxy)
scheme = uri.scheme
proxy_to_use = (scheme == "http" ? http_proxy : https_proxy)
if proxy_to_use
proxy_uri = URI.parse(proxy_to_use)
proxy_user, proxy_pass = proxy_uri.userinfo.split(/:/) if proxy_uri.userinfo
http = Net::HTTP::Proxy(proxy_uri.host, proxy_uri.port, proxy_user, proxy_pass).
new(uri.host, uri.port)
else
http = Net::HTTP.new(uri.host, uri.port)
end
if scheme == "https"
http.use_ssl = true
http.verify_mode = OpenSSL::SSL::VERIFY_NONE
end
return http
end
|