lib/airbrake/sender.rb in airbrake-3.0.4 vs lib/airbrake/sender.rb in airbrake-3.0.5
- old
+ new
@@ -32,11 +32,16 @@
http.read_timeout = http_read_timeout
http.open_timeout = http_open_timeout
if secure
http.use_ssl = true
- http.ca_file = OpenSSL::X509::DEFAULT_CERT_FILE if File.exist?(OpenSSL::X509::DEFAULT_CERT_FILE)
+ if File.exist?(OpenSSL::X509::DEFAULT_CERT_FILE)
+ http.ca_file = OpenSSL::X509::DEFAULT_CERT_FILE
+ else
+ # ca-bundle.crt built from source, see resources/README.md
+ http.ca_file = Sender.local_cert_path
+ end
http.verify_mode = OpenSSL::SSL::VERIFY_PEER
else
http.use_ssl = false
end
@@ -56,9 +61,16 @@
if response && response.respond_to?(:body)
error_id = response.body.match(%r{<error-id[^>]*>(.*?)</error-id>})
error_id[1] if error_id
end
+ end
+
+
+ # Local certificate path.
+ #
+ def self.local_cert_path
+ File.expand_path(File.join("..", "..", "..", "resources", "ca-bundle.crt"), __FILE__)
end
private
attr_reader :proxy_host, :proxy_port, :proxy_user, :proxy_pass, :protocol,