Module: Scout::HTTP
- Included in:
- Command, ServerBase
- Defined in:
- lib/scout/http.rb
Constant Summary collapse
- CA_FILE =
File.join( File.dirname(__FILE__), *%w[.. .. data cacert.pem] )
- VERIFY_MODE =
OpenSSL::SSL::VERIFY_PEER | OpenSSL::SSL::VERIFY_FAIL_IF_NO_PEER_CERT
Instance Method Summary collapse
-
#build_http(uri) ⇒ Object
take care of http/https proxy, if specified in command line options Given a blank string, the proxy_uri URI instance’s host/port/user/pass will be nil Net::HTTP::Proxy returns a regular Net::HTTP class if the first argument (host) is nil.
Instance Method Details
#build_http(uri) ⇒ Object
take care of http/https proxy, if specified in command line options Given a blank string, the proxy_uri URI instance’s host/port/user/pass will be nil Net::HTTP::Proxy returns a regular Net::HTTP class if the first argument (host) is nil
12 13 14 15 16 17 18 19 20 21 22 |
# File 'lib/scout/http.rb', line 12 def build_http(uri) proxy_uri = URI.parse(uri.is_a?(URI::HTTPS) ? @https_proxy : @http_proxy) http = Net::HTTP::Proxy(proxy_uri.host, proxy_uri.port, proxy_uri.user, proxy_uri.port).new(uri.host, uri.port) if uri.is_a?(URI::HTTPS) http.use_ssl = true http.ca_file = CA_FILE http.verify_mode = VERIFY_MODE end http end |