airbrake 3.0.7 → 3.0.8

Sign up to get free protection for your applications and to get access to all the features.
data/CHANGELOG CHANGED
@@ -1,3 +1,9 @@
1
+ Version 3.0.8 - Sun Dec 11 22:14:18 +0100 2011
2
+ ===============================================================================
3
+
4
+ David Palm (15):
5
+ Use OpenSSL::X509::DEFAULT_CERT_FILE to connect only if configured to by setting use_system_ssl_cert_chain to true
6
+
1
7
  Version 3.0.7 - Sun Dec 11 21:04:08 +0100 2011
2
8
  ===============================================================================
3
9
 
@@ -618,3 +624,4 @@ Nick Quaranto (3):
618
624
 
619
625
 
620
626
 
627
+
@@ -106,10 +106,10 @@ module Airbrake
106
106
 
107
107
  if secure?
108
108
  http.use_ssl = true
109
-
110
- if File.exist?(OpenSSL::X509::DEFAULT_CERT_FILE)
111
- http.ca_file = OpenSSL::X509::DEFAULT_CERT_FILE
112
- elsif !use_system_ssl_cert_chain?
109
+
110
+ if use_system_ssl_cert_chain? && File.exist?(OpenSSL::X509::DEFAULT_CERT_FILE)
111
+ http.ca_file = OpenSSL::X509::DEFAULT_CERT_FILE
112
+ else
113
113
  http.ca_file = Sender.local_cert_path # ca-bundle.crt built from source, see resources/README.md
114
114
  end
115
115
  http.verify_mode = OpenSSL::SSL::VERIFY_PEER
@@ -1,3 +1,3 @@
1
1
  module Airbrake
2
- VERSION = '3.0.7'
2
+ VERSION = '3.0.8'
3
3
  end
data/test/sender_test.rb CHANGED
@@ -174,8 +174,9 @@ class SenderTest < Test::Unit::TestCase
174
174
  assert_equal(Airbrake::Sender.local_cert_path, real_http.ca_file)
175
175
  end
176
176
 
177
- should "use the system CAs if asked to" do
178
- config = Airbrake::Configuration.new(:use_system_ssl_cert_chain => true)
177
+ should "use the default DEFAULT_CERT_FILE if asked to" do
178
+ config = Airbrake::Configuration.new
179
+ config.use_system_ssl_cert_chain = true
179
180
  sender = Airbrake::Sender.new(config)
180
181
 
181
182
  assert(sender.use_system_ssl_cert_chain?)
@@ -183,23 +184,27 @@ class SenderTest < Test::Unit::TestCase
183
184
  http = sender.send(:setup_http_connection)
184
185
  assert_not_equal http.ca_file, Airbrake::Sender.local_cert_path
185
186
  end
187
+
188
+ should "verify the connection when the use_ssl option is set (VERIFY_PEER)" do
189
+ sender = build_sender(:secure => true)
190
+ http = sender.send(:setup_http_connection)
191
+ assert_equal(OpenSSL::SSL::VERIFY_PEER, http.verify_mode)
192
+ end
193
+
194
+ should "use the default cert (OpenSSL::X509::DEFAULT_CERT_FILE) only if explicitly told to" do
195
+ sender = build_sender(:secure => true)
196
+ http = sender.send(:setup_http_connection)
197
+
198
+ assert_equal(Airbrake::Sender.local_cert_path, http.ca_file)
186
199
 
187
- should "verify the SSL peer when the use_ssl option is set to true and the default cert exists" do
188
- url = "https://airbrake.io#{Airbrake::Sender::NOTICES_URI}"
189
- uri = URI.parse(url)
190
-
191
- real_http = Net::HTTP.new(uri.host, uri.port)
192
- real_http.stubs(:post => nil)
193
- proxy = stub(:new => real_http)
194
- Net::HTTP.stubs(:Proxy => proxy)
195
200
  File.stubs(:exist?).with(OpenSSL::X509::DEFAULT_CERT_FILE).returns(true)
196
-
197
- send_exception(:secure => true)
198
- assert(real_http.use_ssl?)
199
- assert_equal(OpenSSL::SSL::VERIFY_PEER, real_http.verify_mode)
200
- assert_equal(OpenSSL::X509::DEFAULT_CERT_FILE, real_http.ca_file)
201
+ sender = build_sender(:secure => true, :use_system_ssl_cert_chain => true)
202
+ http = sender.send(:setup_http_connection)
203
+
204
+ assert_not_equal(Airbrake::Sender.local_cert_path, http.ca_file)
205
+ assert_equal(OpenSSL::X509::DEFAULT_CERT_FILE, http.ca_file)
201
206
  end
202
-
207
+
203
208
  should "connect to the right port for ssl" do
204
209
  stub_http
205
210
  send_exception(:secure => true)
metadata CHANGED
@@ -1,13 +1,13 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: airbrake
3
3
  version: !ruby/object:Gem::Version
4
- hash: 9
4
+ hash: 23
5
5
  prerelease:
6
6
  segments:
7
7
  - 3
8
8
  - 0
9
- - 7
10
- version: 3.0.7
9
+ - 8
10
+ version: 3.0.8
11
11
  platform: ruby
12
12
  authors:
13
13
  - thoughtbot, inc