airbrake 3.0.8 → 3.0.9
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- data/CHANGELOG +15 -1
- data/README.md +2 -2
- data/lib/airbrake.rb +1 -0
- data/lib/airbrake/configuration.rb +13 -1
- data/lib/airbrake/sender.rb +8 -14
- data/lib/airbrake/version.rb +1 -1
- data/lib/airbrake_tasks.rb +10 -4
- data/test/airbrake_tasks_test.rb +5 -8
- data/test/sender_test.rb +7 -7
- metadata +4 -4
data/CHANGELOG
CHANGED
@@ -1,7 +1,20 @@
|
|
1
|
+
Version 3.0.9 - Thu Dec 15 23:51:38 +0100 2011
|
2
|
+
===============================================================================
|
3
|
+
|
4
|
+
David Palm (2):
|
5
|
+
Merge pull request #45 from spagalloco/patch-1
|
6
|
+
Pulls in ideas from https://github.com/kidsalsa/airbrake/commit/54982ba83bd6c577a0835b9ba5936c690029244c#L0R2 BUT
|
7
|
+
- moves #ca_bundle_path to Airbrake::Configuration
|
8
|
+
- moves #local_cert_path to Airbrake::Configuration
|
9
|
+
- adds #use_system_ssl_cert_chain? alias to Airbrake::Configuration
|
10
|
+
- makes Airbrake.configure return the created sender (in addition to yielding)
|
11
|
+
- stops airbrake deploy tasks duplicate code form the configuration class
|
12
|
+
- cleanup unused expectations from tests
|
13
|
+
|
1
14
|
Version 3.0.8 - Sun Dec 11 22:14:18 +0100 2011
|
2
15
|
===============================================================================
|
3
16
|
|
4
|
-
David Palm (
|
17
|
+
David Palm (1):
|
5
18
|
Use OpenSSL::X509::DEFAULT_CERT_FILE to connect only if configured to by setting use_system_ssl_cert_chain to true
|
6
19
|
|
7
20
|
Version 3.0.7 - Sun Dec 11 21:04:08 +0100 2011
|
@@ -625,3 +638,4 @@ Nick Quaranto (3):
|
|
625
638
|
|
626
639
|
|
627
640
|
|
641
|
+
|
data/README.md
CHANGED
@@ -13,7 +13,7 @@ For help with using Airbrake and this notifier visit [our support site](http://h
|
|
13
13
|
|
14
14
|
For discussion of Airbrake development check out the [mailing list](http://groups.google.com/group/hoptoad-notifier-dev).
|
15
15
|
|
16
|
-
For SSL verification see the [Resources](resources/README.md).
|
16
|
+
For SSL verification see the [Resources](https://github.com/airbrake/airbrake/blob/master/resources/README.md).
|
17
17
|
|
18
18
|
Rails Installation
|
19
19
|
------------------
|
@@ -430,7 +430,7 @@ Credits
|
|
430
430
|
|
431
431
|
Airbrake is maintained and funded by [thoughtbot, inc](http://thoughtbot.com/community)
|
432
432
|
|
433
|
-
Thank you to all [the contributors](https://github.com/
|
433
|
+
Thank you to all [the contributors](https://github.com/airbrake/airbrake/contributors)!
|
434
434
|
|
435
435
|
The names and logos for thoughtbot are trademarks of thoughtbot, inc.
|
436
436
|
|
data/lib/airbrake.rb
CHANGED
@@ -123,6 +123,7 @@ module Airbrake
|
|
123
123
|
'AbstractController::ActionNotFound']
|
124
124
|
|
125
125
|
alias_method :secure?, :secure
|
126
|
+
alias_method :use_system_ssl_cert_chain?, :use_system_ssl_cert_chain
|
126
127
|
|
127
128
|
def initialize
|
128
129
|
@secure = false
|
@@ -235,9 +236,20 @@ module Airbrake
|
|
235
236
|
warn 'config.environment_filters has been deprecated and has no effect.'
|
236
237
|
[]
|
237
238
|
end
|
239
|
+
|
240
|
+
def ca_bundle_path
|
241
|
+
if use_system_ssl_cert_chain? && File.exist?(OpenSSL::X509::DEFAULT_CERT_FILE)
|
242
|
+
OpenSSL::X509::DEFAULT_CERT_FILE
|
243
|
+
else
|
244
|
+
local_cert_path # ca-bundle.crt built from source, see resources/README.md
|
245
|
+
end
|
246
|
+
end
|
238
247
|
|
239
|
-
|
248
|
+
def local_cert_path
|
249
|
+
File.expand_path(File.join("..", "..", "..", "resources", "ca-bundle.crt"), __FILE__)
|
250
|
+
end
|
240
251
|
|
252
|
+
private
|
241
253
|
def default_port
|
242
254
|
if secure?
|
243
255
|
443
|
data/lib/airbrake/sender.rb
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
module Airbrake
|
2
2
|
# Sends out the notice to Airbrake
|
3
3
|
class Sender
|
4
|
-
|
4
|
+
|
5
5
|
NOTICES_URI = '/notifier_api/v2/notices/'.freeze
|
6
6
|
HTTP_ERRORS = [Timeout::Error,
|
7
7
|
Errno::EINVAL,
|
@@ -58,13 +58,6 @@ module Airbrake
|
|
58
58
|
nil
|
59
59
|
end
|
60
60
|
|
61
|
-
|
62
|
-
# Local certificate path.
|
63
|
-
#
|
64
|
-
def self.local_cert_path
|
65
|
-
File.expand_path(File.join("..", "..", "..", "resources", "ca-bundle.crt"), __FILE__)
|
66
|
-
end
|
67
|
-
|
68
61
|
attr_reader :proxy_host,
|
69
62
|
:proxy_port,
|
70
63
|
:proxy_user,
|
@@ -107,12 +100,13 @@ module Airbrake
|
|
107
100
|
if secure?
|
108
101
|
http.use_ssl = true
|
109
102
|
|
110
|
-
if use_system_ssl_cert_chain? && File.exist?(OpenSSL::X509::DEFAULT_CERT_FILE)
|
111
|
-
|
112
|
-
else
|
113
|
-
|
114
|
-
end
|
115
|
-
http.
|
103
|
+
# if use_system_ssl_cert_chain? && File.exist?(OpenSSL::X509::DEFAULT_CERT_FILE)
|
104
|
+
# http.ca_file = OpenSSL::X509::DEFAULT_CERT_FILE
|
105
|
+
# else
|
106
|
+
# http.ca_file = Sender.local_cert_path # ca-bundle.crt built from source, see resources/README.md
|
107
|
+
# end
|
108
|
+
http.ca_file = Airbrake.configuration.ca_bundle_path
|
109
|
+
http.verify_mode = OpenSSL::SSL::VERIFY_PEER
|
116
110
|
else
|
117
111
|
http.use_ssl = false
|
118
112
|
end
|
data/lib/airbrake/version.rb
CHANGED
data/lib/airbrake_tasks.rb
CHANGED
@@ -25,20 +25,26 @@ module AirbrakeTasks
|
|
25
25
|
end
|
26
26
|
|
27
27
|
dry_run = opts.delete(:dry_run)
|
28
|
-
params = {'api_key' => opts.delete(:api_key) ||
|
29
|
-
Airbrake.configuration.api_key}
|
28
|
+
params = {'api_key' => opts.delete(:api_key) || Airbrake.configuration.api_key}
|
30
29
|
opts.each {|k,v| params["deploy[#{k}]"] = v }
|
31
30
|
|
32
31
|
host = Airbrake.configuration.host || 'airbrake.io'
|
33
|
-
port = Airbrake.configuration.port
|
32
|
+
port = Airbrake.configuration.port
|
34
33
|
|
35
34
|
proxy = Net::HTTP.Proxy(Airbrake.configuration.proxy_host,
|
36
35
|
Airbrake.configuration.proxy_port,
|
37
36
|
Airbrake.configuration.proxy_user,
|
38
37
|
Airbrake.configuration.proxy_pass)
|
39
38
|
http = proxy.new(host, port)
|
40
|
-
http.use_ssl = Airbrake.configuration.secure
|
41
39
|
|
40
|
+
|
41
|
+
|
42
|
+
# Handle Security
|
43
|
+
if Airbrake.configuration.secure?
|
44
|
+
http.use_ssl = true
|
45
|
+
http.ca_file = Airbrake.configuration.ca_bundle_path
|
46
|
+
end
|
47
|
+
|
42
48
|
post = Net::HTTP::Post.new("/deploys.txt")
|
43
49
|
post.set_form_data(params)
|
44
50
|
|
data/test/airbrake_tasks_test.rb
CHANGED
@@ -39,12 +39,11 @@ class AirbrakeTasksTest < Test::Unit::TestCase
|
|
39
39
|
|
40
40
|
context "given an optional HTTP proxy and valid options" do
|
41
41
|
setup do
|
42
|
-
@response = stub("response",
|
43
|
-
@http_proxy = stub("proxy",
|
42
|
+
@response = stub("response", :body => "stub body")
|
43
|
+
@http_proxy = stub("proxy", :request => @response)
|
44
44
|
@http_proxy_class = stub("proxy_class", :new => @http_proxy)
|
45
|
-
@post = stub("post",
|
45
|
+
@post = stub("post", :set_form_data => nil)
|
46
46
|
|
47
|
-
@http_proxy.expects(:use_ssl=).with(Airbrake.configuration.secure)
|
48
47
|
Net::HTTP.expects(:Proxy).
|
49
48
|
with(Airbrake.configuration.proxy_host,
|
50
49
|
Airbrake.configuration.proxy_port,
|
@@ -61,7 +60,7 @@ class AirbrakeTasksTest < Test::Unit::TestCase
|
|
61
60
|
|
62
61
|
should "return true without performing any actual request" do
|
63
62
|
assert_equal true, @output
|
64
|
-
assert_received(@http_proxy, :request) do|expects|
|
63
|
+
assert_received(@http_proxy, :request) do |expects|
|
65
64
|
expects.never
|
66
65
|
end
|
67
66
|
end
|
@@ -141,13 +140,11 @@ class AirbrakeTasksTest < Test::Unit::TestCase
|
|
141
140
|
before_should "post to the custom host" do
|
142
141
|
@post = stub("post", :set_form_data => nil)
|
143
142
|
@http_proxy = stub("proxy", :request => @response)
|
144
|
-
|
143
|
+
|
145
144
|
@http_proxy_class = stub("proxy_class", :new => @http_proxy)
|
146
145
|
@http_proxy_class.expects(:new).with("custom.host", 80).returns(@http_proxy)
|
147
146
|
Net::HTTP.expects(:Proxy).with(any_parameters).returns(@http_proxy_class)
|
148
147
|
Net::HTTP::Post.expects(:new).with("/deploys.txt").returns(@post)
|
149
|
-
# URI.stubs(:parse).with('http://custom.host/deploys.txt').returns(:uri)
|
150
|
-
# Net::HTTP.expects(:post_form).with(:uri, kind_of(Hash)).returns(successful_response)
|
151
148
|
@post.expects(:set_form_data).with(kind_of(Hash))
|
152
149
|
@http_proxy.expects(:request).with(any_parameters).returns(successful_response)
|
153
150
|
end
|
data/test/sender_test.rb
CHANGED
@@ -7,9 +7,9 @@ class SenderTest < Test::Unit::TestCase
|
|
7
7
|
end
|
8
8
|
|
9
9
|
def build_sender(opts = {})
|
10
|
-
|
11
|
-
|
12
|
-
|
10
|
+
Airbrake.configure do |conf|
|
11
|
+
opts.each {|opt, value| conf.send(:"#{opt}=", value) }
|
12
|
+
end
|
13
13
|
end
|
14
14
|
|
15
15
|
def send_exception(args = {})
|
@@ -171,7 +171,7 @@ class SenderTest < Test::Unit::TestCase
|
|
171
171
|
send_exception(:secure => true)
|
172
172
|
assert(real_http.use_ssl?)
|
173
173
|
assert_equal(OpenSSL::SSL::VERIFY_PEER, real_http.verify_mode)
|
174
|
-
assert_equal(Airbrake
|
174
|
+
assert_equal(Airbrake.configuration.local_cert_path, real_http.ca_file)
|
175
175
|
end
|
176
176
|
|
177
177
|
should "use the default DEFAULT_CERT_FILE if asked to" do
|
@@ -182,7 +182,7 @@ class SenderTest < Test::Unit::TestCase
|
|
182
182
|
assert(sender.use_system_ssl_cert_chain?)
|
183
183
|
|
184
184
|
http = sender.send(:setup_http_connection)
|
185
|
-
assert_not_equal http.ca_file,
|
185
|
+
assert_not_equal http.ca_file, config.local_cert_path
|
186
186
|
end
|
187
187
|
|
188
188
|
should "verify the connection when the use_ssl option is set (VERIFY_PEER)" do
|
@@ -195,13 +195,13 @@ class SenderTest < Test::Unit::TestCase
|
|
195
195
|
sender = build_sender(:secure => true)
|
196
196
|
http = sender.send(:setup_http_connection)
|
197
197
|
|
198
|
-
assert_equal(Airbrake
|
198
|
+
assert_equal(Airbrake.configuration.local_cert_path, http.ca_file)
|
199
199
|
|
200
200
|
File.stubs(:exist?).with(OpenSSL::X509::DEFAULT_CERT_FILE).returns(true)
|
201
201
|
sender = build_sender(:secure => true, :use_system_ssl_cert_chain => true)
|
202
202
|
http = sender.send(:setup_http_connection)
|
203
203
|
|
204
|
-
assert_not_equal(Airbrake
|
204
|
+
assert_not_equal(Airbrake.configuration.local_cert_path, http.ca_file)
|
205
205
|
assert_equal(OpenSSL::X509::DEFAULT_CERT_FILE, http.ca_file)
|
206
206
|
end
|
207
207
|
|
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:
|
4
|
+
hash: 21
|
5
5
|
prerelease:
|
6
6
|
segments:
|
7
7
|
- 3
|
8
8
|
- 0
|
9
|
-
-
|
10
|
-
version: 3.0.
|
9
|
+
- 9
|
10
|
+
version: 3.0.9
|
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-
|
18
|
+
date: 2011-12-15 00:00:00 Z
|
19
19
|
dependencies:
|
20
20
|
- !ruby/object:Gem::Dependency
|
21
21
|
name: builder
|