lib/appsignal/transmitter.rb in appsignal-0.12.beta.31 vs lib/appsignal/transmitter.rb in appsignal-0.12.beta.32
- old
+ new
@@ -58,15 +58,42 @@
)
end
end
def http_client
- Net::HTTP.new(uri.host, uri.port).tap do |http|
+ client = if config[:http_proxy]
+ Net::HTTP.new(uri.host, uri.port, proxy_addr, proxy_port)
+ else
+ Net::HTTP.new(uri.host, uri.port)
+ end
+
+ client.tap do |http|
if uri.scheme == 'https'
- http.use_ssl = true
+ http.use_ssl = true
+ http.ssl_version = :TLSv1
http.verify_mode = OpenSSL::SSL::VERIFY_PEER
- http.ca_file = CA_FILE_PATH
+ http.ca_file = CA_FILE_PATH
end
+ end
+ end
+
+ def proxy_uri
+ @proxy_uri ||= URI.parse(config[:http_proxy])
+ end
+
+ def proxy_addr
+ if config[:http_proxy]
+ proxy_uri.host
+ else
+ nil
+ end
+ end
+
+ def proxy_port
+ if config[:http_proxy]
+ proxy_uri.port
+ else
+ nil
end
end
end
end