airbrake 3.0.6 → 3.0.7

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.7 - Sun Dec 11 21:04:08 +0100 2011
2
+ ===============================================================================
3
+
4
+ David Palm (1):
5
+ Adds a :use_system_ssl_cert_chain configuration option to allow use of the system default SSL chain (as opposed to the CAs bundled with Airbrake) - defaults to false
6
+
1
7
  Version 3.0.6 - Mon Dec 05 16:41:39 +0100 2011
2
8
  ===============================================================================
3
9
 
@@ -611,3 +617,4 @@ Nick Quaranto (3):
611
617
 
612
618
 
613
619
 
620
+
data/Rakefile CHANGED
@@ -155,7 +155,9 @@ def run_rails_cucumbr_task(version, additional_cucumber_args)
155
155
  raise "No Rails version specified - make sure ENV['RAILS_VERSION'] is set, e.g. with `rake cucumber:rails:all`"
156
156
  end
157
157
  ENV['RAILS_VERSION'] = version
158
- system("cucumber --format #{ENV['CUCUMBER_FORMAT'] || 'progress'} #{additional_cucumber_args} features/rails.feature features/rails_with_js_notifier.feature")
158
+ cmd = "cucumber --format #{ENV['CUCUMBER_FORMAT'] || 'progress'} #{additional_cucumber_args} features/rails.feature features/rails_with_js_notifier.feature"
159
+ puts "Running command: #{cmd}"
160
+ system(cmd)
159
161
  end
160
162
 
161
163
  def define_rails_cucumber_tasks(additional_cucumber_args = '')
@@ -7,8 +7,8 @@ module Airbrake
7
7
  :http_open_timeout, :http_read_timeout, :ignore, :ignore_by_filters,
8
8
  :ignore_user_agent, :notifier_name, :notifier_url, :notifier_version,
9
9
  :params_filters, :project_root, :port, :protocol, :proxy_host,
10
- :proxy_pass, :proxy_port, :proxy_user, :secure, :framework,
11
- :user_information, :rescue_rake_exceptions].freeze
10
+ :proxy_pass, :proxy_port, :proxy_user, :secure, :use_system_ssl_cert_chain,
11
+ :framework, :user_information, :rescue_rake_exceptions].freeze
12
12
 
13
13
  # The API key for your project, found on the project edit form.
14
14
  attr_accessor :api_key
@@ -22,6 +22,9 @@ module Airbrake
22
22
 
23
23
  # +true+ for https connections, +false+ for http connections.
24
24
  attr_accessor :secure
25
+
26
+ # +true+ to use whatever CAs OpenSSL has installed on your system. +false+ to use the ca-bundle.crt file included in Airbrake itself (reccomended and default)
27
+ attr_accessor :use_system_ssl_cert_chain
25
28
 
26
29
  # The HTTP open timeout in seconds (defaults to 2).
27
30
  attr_accessor :http_open_timeout
@@ -123,6 +126,7 @@ module Airbrake
123
126
 
124
127
  def initialize
125
128
  @secure = false
129
+ @use_system_ssl_cert_chain= false
126
130
  @host = 'airbrake.io'
127
131
  @http_open_timeout = 2
128
132
  @http_read_timeout = 5
@@ -13,8 +13,18 @@ module Airbrake
13
13
  Errno::ECONNREFUSED].freeze
14
14
 
15
15
  def initialize(options = {})
16
- [:proxy_host, :proxy_port, :proxy_user, :proxy_pass, :protocol,
17
- :host, :port, :secure, :http_open_timeout, :http_read_timeout].each do |option|
16
+ [ :proxy_host,
17
+ :proxy_port,
18
+ :proxy_user,
19
+ :proxy_pass,
20
+ :protocol,
21
+ :host,
22
+ :port,
23
+ :secure,
24
+ :use_system_ssl_cert_chain,
25
+ :http_open_timeout,
26
+ :http_read_timeout
27
+ ].each do |option|
18
28
  instance_variable_set("@#{option}", options[option])
19
29
  end
20
30
  end
@@ -55,10 +65,22 @@ module Airbrake
55
65
  File.expand_path(File.join("..", "..", "..", "resources", "ca-bundle.crt"), __FILE__)
56
66
  end
57
67
 
58
- private
59
-
60
- attr_reader :proxy_host, :proxy_port, :proxy_user, :proxy_pass, :protocol,
61
- :host, :port, :secure, :http_open_timeout, :http_read_timeout
68
+ attr_reader :proxy_host,
69
+ :proxy_port,
70
+ :proxy_user,
71
+ :proxy_pass,
72
+ :protocol,
73
+ :host,
74
+ :port,
75
+ :secure,
76
+ :use_system_ssl_cert_chain,
77
+ :http_open_timeout,
78
+ :http_read_timeout
79
+
80
+ alias_method :secure?, :secure
81
+ alias_method :use_system_ssl_cert_chain?, :use_system_ssl_cert_chain
82
+
83
+ private
62
84
 
63
85
  def url
64
86
  URI.parse("#{protocol}://#{host}:#{port}").merge(NOTICES_URI)
@@ -82,13 +104,13 @@ module Airbrake
82
104
  http.read_timeout = http_read_timeout
83
105
  http.open_timeout = http_open_timeout
84
106
 
85
- if secure
107
+ if secure?
86
108
  http.use_ssl = true
109
+
87
110
  if File.exist?(OpenSSL::X509::DEFAULT_CERT_FILE)
88
- http.ca_file = OpenSSL::X509::DEFAULT_CERT_FILE
89
- else
90
- # ca-bundle.crt built from source, see resources/README.md
91
- http.ca_file = Sender.local_cert_path
111
+ http.ca_file = OpenSSL::X509::DEFAULT_CERT_FILE
112
+ elsif !use_system_ssl_cert_chain?
113
+ http.ca_file = Sender.local_cert_path # ca-bundle.crt built from source, see resources/README.md
92
114
  end
93
115
  http.verify_mode = OpenSSL::SSL::VERIFY_PEER
94
116
  else
@@ -1,3 +1,3 @@
1
1
  module Airbrake
2
- VERSION = "3.0.6".freeze
2
+ VERSION = '3.0.7'
3
3
  end
@@ -9,7 +9,7 @@ class SenderTest < Test::Unit::TestCase
9
9
  def build_sender(opts = {})
10
10
  config = Airbrake::Configuration.new
11
11
  opts.each {|opt, value| config.send(:"#{opt}=", value) }
12
- Airbrake::Sender.new(config)
12
+ sender = Airbrake::Sender.new(config)
13
13
  end
14
14
 
15
15
  def send_exception(args = {})
@@ -173,6 +173,16 @@ class SenderTest < Test::Unit::TestCase
173
173
  assert_equal(OpenSSL::SSL::VERIFY_PEER, real_http.verify_mode)
174
174
  assert_equal(Airbrake::Sender.local_cert_path, real_http.ca_file)
175
175
  end
176
+
177
+ should "use the system CAs if asked to" do
178
+ config = Airbrake::Configuration.new(:use_system_ssl_cert_chain => true)
179
+ sender = Airbrake::Sender.new(config)
180
+
181
+ assert(sender.use_system_ssl_cert_chain?)
182
+
183
+ http = sender.send(:setup_http_connection)
184
+ assert_not_equal http.ca_file, Airbrake::Sender.local_cert_path
185
+ end
176
186
 
177
187
  should "verify the SSL peer when the use_ssl option is set to true and the default cert exists" do
178
188
  url = "https://airbrake.io#{Airbrake::Sender::NOTICES_URI}"
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: 11
4
+ hash: 9
5
5
  prerelease:
6
6
  segments:
7
7
  - 3
8
8
  - 0
9
- - 6
10
- version: 3.0.6
9
+ - 7
10
+ version: 3.0.7
11
11
  platform: ruby
12
12
  authors:
13
13
  - thoughtbot, inc
@@ -15,7 +15,7 @@ autorequire:
15
15
  bindir: bin
16
16
  cert_chain: []
17
17
 
18
- date: 2011-12-06 00:00:00 Z
18
+ date: 2011-12-11 00:00:00 Z
19
19
  dependencies:
20
20
  - !ruby/object:Gem::Dependency
21
21
  name: builder