grocer 0.1.1 → 0.2.0
Sign up to get free protection for your applications and to get access to all the features.
- data/CHANGELOG.md +7 -1
- data/lib/grocer/certificate_expired_error.rb +3 -0
- data/lib/grocer/connection.rb +7 -1
- data/lib/grocer/version.rb +1 -1
- data/spec/grocer/connection_spec.rb +5 -0
- metadata +2 -1
data/CHANGELOG.md
CHANGED
@@ -1,5 +1,10 @@
|
|
1
1
|
# CHANGELOG
|
2
2
|
|
3
|
+
## 0.2.0
|
4
|
+
|
5
|
+
* Don't retry connection when the certificate has expired. (Kyle Drake and
|
6
|
+
Jesse Storimer)
|
7
|
+
|
3
8
|
## 0.1.1
|
4
9
|
|
5
10
|
* Warn that `jruby-openssl` is needed on JRuby platform. (Kyle Drake)
|
@@ -7,7 +12,8 @@
|
|
7
12
|
## 0.1.0
|
8
13
|
|
9
14
|
* Enables socket keepalive option on APNS client sockets (Kyle Drake)
|
10
|
-
* Supports non-ASCII characters in notifications (Patrick Van Stee, Andy
|
15
|
+
* Supports non-ASCII characters in notifications (Patrick Van Stee, Andy
|
16
|
+
Lindeman)
|
11
17
|
* Certificate can be any object that responds to #read (Kyle Drake)
|
12
18
|
|
13
19
|
## 0.0.13
|
data/lib/grocer/connection.rb
CHANGED
@@ -1,6 +1,7 @@
|
|
1
1
|
require 'grocer'
|
2
2
|
require 'grocer/no_gateway_error'
|
3
3
|
require 'grocer/no_port_error'
|
4
|
+
require 'grocer/certificate_expired_error'
|
4
5
|
require 'grocer/ssl_connection'
|
5
6
|
|
6
7
|
module Grocer
|
@@ -56,7 +57,12 @@ module Grocer
|
|
56
57
|
begin
|
57
58
|
connect
|
58
59
|
yield
|
59
|
-
rescue
|
60
|
+
rescue => e
|
61
|
+
if e.class == OpenSSL::SSL::SSLError && e.message =~ /certificate expired/i
|
62
|
+
e.extend(CertificateExpiredError)
|
63
|
+
raise
|
64
|
+
end
|
65
|
+
|
60
66
|
raise unless attempts < retries
|
61
67
|
|
62
68
|
destroy_connection
|
data/lib/grocer/version.rb
CHANGED
@@ -55,6 +55,11 @@ describe Grocer::Connection do
|
|
55
55
|
subject.connect
|
56
56
|
ssl.should have_received(:connect)
|
57
57
|
end
|
58
|
+
|
59
|
+
it 'raises CertificateExpiredError for OpenSSL::SSL::SSLError with /certificate expired/i message' do
|
60
|
+
ssl.stubs(:write).raises(OpenSSL::SSL::SSLError.new('certificate expired'))
|
61
|
+
-> {subject.write('abc123')}.should raise_error(Grocer::CertificateExpiredError)
|
62
|
+
end
|
58
63
|
|
59
64
|
context 'an open SSLConnection' do
|
60
65
|
before do
|
metadata
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: grocer
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.
|
4
|
+
version: 0.2.0
|
5
5
|
prerelease:
|
6
6
|
platform: ruby
|
7
7
|
authors:
|
@@ -133,6 +133,7 @@ files:
|
|
133
133
|
- Rakefile
|
134
134
|
- grocer.gemspec
|
135
135
|
- lib/grocer.rb
|
136
|
+
- lib/grocer/certificate_expired_error.rb
|
136
137
|
- lib/grocer/connection.rb
|
137
138
|
- lib/grocer/extensions/deep_symbolize_keys.rb
|
138
139
|
- lib/grocer/failed_delivery_attempt.rb
|