net-http-persistent 1.8.1 → 1.9
Sign up to get free protection for your applications and to get access to all the features.
- data.tar.gz.sig +0 -0
- data/History.txt +10 -0
- data/lib/net/http/persistent.rb +24 -2
- data/test/test_net_http_persistent.rb +23 -0
- metadata +9 -12
- metadata.gz.sig +0 -0
data.tar.gz.sig
CHANGED
Binary file
|
data/History.txt
CHANGED
@@ -1,3 +1,13 @@
|
|
1
|
+
=== 1.9 / 2011-08-26
|
2
|
+
|
3
|
+
* Minor Enhancement
|
4
|
+
* Added Net::HTTP::Persistent#cert_store to set an SSL certificate store
|
5
|
+
which defaults to the OpenSSL default certificate store.
|
6
|
+
|
7
|
+
HTTPS server certificates will be validated when this option is combined
|
8
|
+
with setting Net::HTTP::Persistent#verify_mode to
|
9
|
+
OpenSSL::SSL::VERIFY_PEER.
|
10
|
+
|
1
11
|
=== 1.8.1 / 2011-08-08
|
2
12
|
|
3
13
|
* Bug Fix
|
data/lib/net/http/persistent.rb
CHANGED
@@ -43,7 +43,7 @@ class Net::HTTP::Persistent
|
|
43
43
|
##
|
44
44
|
# The version of Net::HTTP::Persistent use are using
|
45
45
|
|
46
|
-
VERSION = '1.
|
46
|
+
VERSION = '1.9'
|
47
47
|
|
48
48
|
##
|
49
49
|
# Error class for errors raised by Net::HTTP::Persistent. Various
|
@@ -63,6 +63,12 @@ class Net::HTTP::Persistent
|
|
63
63
|
|
64
64
|
attr_accessor :ca_file
|
65
65
|
|
66
|
+
##
|
67
|
+
# An SSL certificate store. Setting this will override the default
|
68
|
+
# certificate store. See verify_mode for more information.
|
69
|
+
|
70
|
+
attr_accessor :cert_store
|
71
|
+
|
66
72
|
##
|
67
73
|
# Where this instance's connections live in the thread local variables
|
68
74
|
|
@@ -149,6 +155,10 @@ class Net::HTTP::Persistent
|
|
149
155
|
# HTTPS verify mode. Defaults to OpenSSL::SSL::VERIFY_NONE which ignores
|
150
156
|
# certificate problems.
|
151
157
|
#
|
158
|
+
# Setting this to OpenSSL::SSL::VERIFY_PEER will, if no certificate, ca_file
|
159
|
+
# or cert_store are otherwhise set, use the systems default certificate
|
160
|
+
# store. This means it will use the Operating Systems root CA certificates.
|
161
|
+
#
|
152
162
|
# You can use +verify_mode+ to override any default values.
|
153
163
|
|
154
164
|
attr_accessor :verify_mode
|
@@ -223,6 +233,7 @@ class Net::HTTP::Persistent
|
|
223
233
|
@private_key = nil
|
224
234
|
@verify_callback = nil
|
225
235
|
@verify_mode = nil
|
236
|
+
@cert_store = nil
|
226
237
|
|
227
238
|
@retry_change_requests = false
|
228
239
|
end
|
@@ -523,7 +534,18 @@ class Net::HTTP::Persistent
|
|
523
534
|
connection.key = @private_key
|
524
535
|
end
|
525
536
|
|
526
|
-
connection.
|
537
|
+
connection.cert_store = @cert_store if @cert_store
|
538
|
+
|
539
|
+
if @verify_mode then
|
540
|
+
connection.verify_mode = @verify_mode
|
541
|
+
|
542
|
+
connection.cert_store ||= begin
|
543
|
+
store = OpenSSL::X509::Store.new
|
544
|
+
store.set_default_paths
|
545
|
+
store
|
546
|
+
end
|
547
|
+
end
|
548
|
+
|
527
549
|
end
|
528
550
|
|
529
551
|
end
|
@@ -774,6 +774,29 @@ class TestNetHttpPersistent < MiniTest::Unit::TestCase
|
|
774
774
|
assert_equal :callback, c.verify_callback
|
775
775
|
end
|
776
776
|
|
777
|
+
def test_ssl_cert_store
|
778
|
+
store = OpenSSL::X509::Store.new
|
779
|
+
@http.cert_store = store
|
780
|
+
|
781
|
+
c = Net::HTTP.new 'localhost', 80
|
782
|
+
|
783
|
+
@http.ssl c
|
784
|
+
|
785
|
+
assert c.use_ssl?
|
786
|
+
assert_equal store, c.cert_store
|
787
|
+
end
|
788
|
+
|
789
|
+
def test_default_cert_store
|
790
|
+
@http.verify_mode = OpenSSL::SSL::VERIFY_PEER
|
791
|
+
|
792
|
+
c = Net::HTTP.new 'localhost', 80
|
793
|
+
|
794
|
+
@http.ssl c
|
795
|
+
|
796
|
+
assert c.use_ssl?
|
797
|
+
assert c.cert_store
|
798
|
+
end
|
799
|
+
|
777
800
|
def test_ssl_certificate
|
778
801
|
@http.certificate = :cert
|
779
802
|
@http.private_key = :key
|
metadata
CHANGED
@@ -1,13 +1,12 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: net-http-persistent
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
hash:
|
4
|
+
hash: 29
|
5
5
|
prerelease:
|
6
6
|
segments:
|
7
7
|
- 1
|
8
|
-
-
|
9
|
-
|
10
|
-
version: 1.8.1
|
8
|
+
- 9
|
9
|
+
version: "1.9"
|
11
10
|
platform: ruby
|
12
11
|
authors:
|
13
12
|
- Eric Hodel
|
@@ -36,7 +35,7 @@ cert_chain:
|
|
36
35
|
x52qPcexcYZR7w==
|
37
36
|
-----END CERTIFICATE-----
|
38
37
|
|
39
|
-
date: 2011-08-
|
38
|
+
date: 2011-08-27 00:00:00 Z
|
40
39
|
dependencies:
|
41
40
|
- !ruby/object:Gem::Dependency
|
42
41
|
name: minitest
|
@@ -62,11 +61,11 @@ dependencies:
|
|
62
61
|
requirements:
|
63
62
|
- - ~>
|
64
63
|
- !ruby/object:Gem::Version
|
65
|
-
hash:
|
64
|
+
hash: 27
|
66
65
|
segments:
|
67
66
|
- 2
|
68
|
-
-
|
69
|
-
version: "2.
|
67
|
+
- 12
|
68
|
+
version: "2.12"
|
70
69
|
type: :development
|
71
70
|
version_requirements: *id002
|
72
71
|
description: |-
|
@@ -103,8 +102,6 @@ files:
|
|
103
102
|
homepage: http://docs.seattlerb.org/net-http-persistent
|
104
103
|
licenses: []
|
105
104
|
|
106
|
-
metadata: {}
|
107
|
-
|
108
105
|
post_install_message:
|
109
106
|
rdoc_options:
|
110
107
|
- --main
|
@@ -132,9 +129,9 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
132
129
|
requirements: []
|
133
130
|
|
134
131
|
rubyforge_project: net-http-persistent
|
135
|
-
rubygems_version: 1.8.
|
132
|
+
rubygems_version: 1.8.9
|
136
133
|
signing_key:
|
137
|
-
specification_version:
|
134
|
+
specification_version: 3
|
138
135
|
summary: Manages persistent connections using Net::HTTP plus a speed fix for Ruby 1.8
|
139
136
|
test_files:
|
140
137
|
- test/test_net_http_persistent.rb
|
metadata.gz.sig
CHANGED
Binary file
|