httpclient 2.8.2 → 2.8.2.1
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/lib/httpclient/session.rb +1 -1
- data/lib/httpclient/ssl_config.rb +21 -15
- data/lib/httpclient/version.rb +1 -1
- data/test/test_ssl.rb +10 -0
- metadata +2 -2
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 2b5686de1cd51430fc814921d00eef9589abb460
|
4
|
+
data.tar.gz: f4882d0555214f10727a0f0f43e76952167a5bc0
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 47c2d49d8395a7c2c3d5994f3d91315d787a6b18d7b6cb7b7f0b85144c41930092d7518a3be7df990db2918e6dc661d0422a7d0c699f413c58bd62dd9b8c3119
|
7
|
+
data.tar.gz: e37781d77163754c473a2b0e73990c079788b3117ce11fed68d7761060f765bb51ddeca0c3acea4d45ddc9cf9ba5c37c5c443e589d3ccfefb36359c07a4c57b2
|
data/lib/httpclient/session.rb
CHANGED
@@ -21,7 +21,7 @@ require 'zlib'
|
|
21
21
|
require 'httpclient/timeout' # TODO: remove this once we drop 1.8 support
|
22
22
|
require 'httpclient/ssl_config'
|
23
23
|
require 'httpclient/http'
|
24
|
-
if
|
24
|
+
if RUBY_ENGINE == 'jruby'
|
25
25
|
require 'httpclient/jruby_ssl_socket'
|
26
26
|
else
|
27
27
|
require 'httpclient/ssl_socket'
|
@@ -39,21 +39,27 @@ class HTTPClient
|
|
39
39
|
if SSLEnabled
|
40
40
|
include OpenSSL
|
41
41
|
|
42
|
-
|
43
|
-
module
|
44
|
-
|
45
|
-
|
46
|
-
|
47
|
-
|
48
|
-
|
49
|
-
|
50
|
-
|
42
|
+
if RUBY_ENGINE == 'jruby'
|
43
|
+
module ::OpenSSL
|
44
|
+
module X509
|
45
|
+
class Store
|
46
|
+
attr_reader :_httpclient_cert_store_items
|
47
|
+
|
48
|
+
# TODO: use prepend instead when we drop JRuby + 1.9.x support
|
49
|
+
wrapped = {}
|
50
|
+
|
51
|
+
wrapped[:initialize] = instance_method(:initialize)
|
52
|
+
define_method(:initialize) do |*args|
|
53
|
+
wrapped[:initialize].bind(self).call(*args)
|
54
|
+
@_httpclient_cert_store_items = [ENV['SSL_CERT_FILE'] || :default]
|
55
|
+
end
|
51
56
|
|
52
|
-
|
53
|
-
|
54
|
-
|
55
|
-
|
56
|
-
|
57
|
+
[:add_cert, :add_file, :add_path].each do |m|
|
58
|
+
wrapped[m] = instance_method(m)
|
59
|
+
define_method(m) do |cert|
|
60
|
+
wrapped[m].bind(self).call(cert)
|
61
|
+
@_httpclient_cert_store_items << cert
|
62
|
+
end
|
57
63
|
end
|
58
64
|
end
|
59
65
|
end
|
@@ -112,7 +118,7 @@ class HTTPClient
|
|
112
118
|
attr_reader :client_ca # :nodoc:
|
113
119
|
|
114
120
|
# These array keeps original files/dirs that was added to @cert_store
|
115
|
-
def cert_store_items; @cert_store._httpclient_cert_store_items; end
|
121
|
+
def cert_store_items; @cert_store._httpclient_cert_store_items || []; end
|
116
122
|
attr_reader :cert_store_crl_items
|
117
123
|
|
118
124
|
# Creates a SSLConfig.
|
data/lib/httpclient/version.rb
CHANGED
data/test/test_ssl.rb
CHANGED
@@ -80,6 +80,16 @@ end
|
|
80
80
|
assert(str.scan(/^hello$/)[0])
|
81
81
|
end
|
82
82
|
|
83
|
+
def test_verification_without_httpclient
|
84
|
+
raw_cert = "-----BEGIN CERTIFICATE-----\nMIIDOTCCAiGgAwIBAgIBAjANBgkqhkiG9w0BAQsFADBCMRMwEQYKCZImiZPyLGQB\nGRYDb3JnMRkwFwYKCZImiZPyLGQBGRYJcnVieS1sYW5nMRAwDgYDVQQDDAdSdWJ5\nIENBMB4XDTE2MDgxMDE3MjEzNFoXDTE3MDgxMDE3MjEzNFowSzETMBEGCgmSJomT\n8ixkARkWA29yZzE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HTh3Whm5kmCdWcBJU0QmSq42ZL\n72U0PXLR\n-----END CERTIFICATE-----"
|
86
|
+
ca_cert = ::OpenSSL::X509::Certificate.new(raw_ca_cert)
|
87
|
+
cert = ::OpenSSL::X509::Certificate.new(raw_cert)
|
88
|
+
store = ::OpenSSL::X509::Store.new
|
89
|
+
store.add_cert(ca_cert)
|
90
|
+
assert(store.verify(cert))
|
91
|
+
end
|
92
|
+
|
83
93
|
def test_verification
|
84
94
|
cfg = @client.ssl_config
|
85
95
|
cfg.verify_callback = method(:verify_callback).to_proc
|
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: httpclient
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 2.8.2
|
4
|
+
version: 2.8.2.1
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Hiroshi Nakamura
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date: 2016-08-
|
11
|
+
date: 2016-08-16 00:00:00.000000000 Z
|
12
12
|
dependencies: []
|
13
13
|
description:
|
14
14
|
email: nahi@ruby-lang.org
|