httpi 2.4.3 → 3.0.0
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/.github/workflows/development.yml +48 -0
- data/CHANGELOG.md +23 -0
- data/Gemfile +8 -6
- data/README.md +20 -16
- data/UPDATING.md +7 -0
- data/httpi.gemspec +5 -8
- data/lib/httpi/adapter/curb.rb +7 -2
- data/lib/httpi/adapter/em_http.rb +5 -4
- data/lib/httpi/adapter/excon.rb +6 -1
- data/lib/httpi/adapter/http.rb +9 -0
- data/lib/httpi/adapter/httpclient.rb +5 -0
- data/lib/httpi/adapter/net_http.rb +10 -2
- data/lib/httpi/adapter/net_http_persistent.rb +6 -2
- data/lib/httpi/auth/ssl.rb +53 -2
- data/lib/httpi/request.rb +2 -2
- data/lib/httpi/version.rb +1 -1
- data/spec/fixtures/client_cert.pem +18 -14
- data/spec/fixtures/client_key.pem +25 -13
- data/spec/httpi/adapter/curb_spec.rb +31 -7
- data/spec/httpi/adapter/em_http_spec.rb +23 -21
- data/spec/httpi/adapter/excon_spec.rb +28 -118
- data/spec/httpi/adapter/http_spec.rb +23 -96
- data/spec/httpi/adapter/httpclient_spec.rb +32 -0
- data/spec/httpi/adapter/net_http_persistent_spec.rb +31 -81
- data/spec/httpi/adapter/net_http_spec.rb +37 -181
- data/spec/httpi/auth/ssl_spec.rb +48 -0
- data/spec/httpi/httpi_spec.rb +2 -4
- data/spec/integration/curb_spec.rb +20 -0
- data/spec/integration/em_http_spec.rb +19 -2
- data/spec/integration/excon_spec.rb +67 -1
- data/spec/integration/fixtures/ca_all.pem +17 -42
- data/spec/integration/fixtures/server.cert +17 -17
- data/spec/integration/fixtures/server.key +25 -13
- data/spec/integration/http_spec.rb +47 -0
- data/spec/integration/httpclient_spec.rb +20 -0
- data/spec/integration/net_http_persistent_spec.rb +33 -3
- data/spec/integration/net_http_spec.rb +144 -1
- data/spec/integration/support/application.rb +3 -2
- data/spec/integration/support/server.rb +1 -2
- data/spec/spec_helper.rb +0 -2
- metadata +15 -43
- data/.travis.yml +0 -15
@@ -1,198 +1,54 @@
|
|
1
1
|
require "spec_helper"
|
2
|
-
require "
|
2
|
+
require "httpi/adapter/net_http"
|
3
|
+
require "httpi/request"
|
3
4
|
|
4
|
-
|
5
|
+
begin
|
6
|
+
HTTPI::Adapter.load_adapter(:net_http)
|
5
7
|
|
6
|
-
|
8
|
+
describe HTTPI::Adapter::NetHTTP do
|
9
|
+
let(:adapter) { HTTPI::Adapter::NetHTTP.new(request) }
|
10
|
+
let(:request) { HTTPI::Request.new("http://example.com") }
|
7
11
|
|
8
|
-
|
9
|
-
|
10
|
-
|
11
|
-
|
12
|
-
|
13
|
-
after :all do
|
14
|
-
@server.stop
|
15
|
-
end
|
16
|
-
|
17
|
-
context 'when socks is specified' do
|
18
|
-
|
19
|
-
let(:socks_client) { mock('socks_client') }
|
20
|
-
let(:request){HTTPI::Request.new(@server.url)}
|
21
|
-
|
22
|
-
it 'uses Net::HTTP.SOCKSProxy as client' do
|
23
|
-
socks_client.expects(:new).with(URI(@server.url).host, URI(@server.url).port).returns(:socks_client_instance)
|
24
|
-
Net::HTTP.expects(:SOCKSProxy).with('localhost', 8080).returns socks_client
|
25
|
-
|
26
|
-
request.proxy = 'socks://localhost:8080'
|
27
|
-
adapter = HTTPI::Adapter::NetHTTP.new(request)
|
28
|
-
|
29
|
-
expect(adapter.client).to eq(:socks_client_instance)
|
12
|
+
let(:response) {
|
13
|
+
Object.new.tap do |r|
|
14
|
+
r.stubs(:code).returns(200)
|
15
|
+
r.stubs(:body).returns("abc")
|
16
|
+
r.stubs(:to_hash).returns({"Content-Length" => "3"})
|
30
17
|
end
|
31
|
-
|
32
|
-
|
33
|
-
it "sends and receives HTTP headers" do
|
34
|
-
request = HTTPI::Request.new(@server.url + "x-header")
|
35
|
-
request.headers["X-Header"] = "HTTPI"
|
36
|
-
|
37
|
-
response = HTTPI.get(request, adapter)
|
38
|
-
expect(response.body).to include("HTTPI")
|
39
|
-
end
|
18
|
+
}
|
40
19
|
|
41
|
-
|
42
|
-
|
43
|
-
expect(response.body).to eq("get")
|
44
|
-
expect(response.headers["Content-Type"]).to eq("text/plain")
|
20
|
+
before do
|
21
|
+
Net::HTTP.any_instance.stubs(:start).returns(response)
|
45
22
|
end
|
46
23
|
|
47
|
-
|
48
|
-
|
49
|
-
|
50
|
-
|
51
|
-
|
52
|
-
|
53
|
-
it "executes HEAD requests" do
|
54
|
-
response = HTTPI.head(@server.url, adapter)
|
55
|
-
expect(response.code).to eq(200)
|
56
|
-
expect(response.headers["Content-Type"]).to eq("text/plain")
|
57
|
-
end
|
24
|
+
describe "settings" do
|
25
|
+
describe "open_timeout, read_timeout" do
|
26
|
+
it "are being set on the client" do
|
27
|
+
request.open_timeout = 30
|
28
|
+
request.read_timeout = 40
|
58
29
|
|
59
|
-
|
60
|
-
|
61
|
-
expect(response.body).to eq("put")
|
62
|
-
expect(response.headers["Content-Type"]).to eq("text/plain")
|
63
|
-
end
|
30
|
+
adapter.client.expects(:open_timeout=).with(30)
|
31
|
+
adapter.client.expects(:read_timeout=).with(40)
|
64
32
|
|
65
|
-
|
66
|
-
response = HTTPI.delete(@server.url, adapter)
|
67
|
-
expect(response.body).to eq("delete")
|
68
|
-
expect(response.headers["Content-Type"]).to eq("text/plain")
|
69
|
-
end
|
70
|
-
|
71
|
-
context "supports custom methods supported by Net::HTTP" do
|
72
|
-
let(:request) do
|
73
|
-
HTTPI::Request.new(@server.url).tap do|r|
|
74
|
-
r.body = request_body if request_body
|
33
|
+
adapter.request(:get)
|
75
34
|
end
|
76
35
|
end
|
77
36
|
|
78
|
-
|
79
|
-
|
80
|
-
|
81
|
-
|
82
|
-
|
83
|
-
|
84
|
-
|
85
|
-
|
86
|
-
|
87
|
-
|
88
|
-
|
89
|
-
|
90
|
-
|
91
|
-
|
92
|
-
end
|
93
|
-
|
94
|
-
context 'UNSUPPORTED method' do
|
95
|
-
let(:http_method) { :unsupported }
|
96
|
-
|
97
|
-
specify { expect { response }.to raise_error HTTPI::NotSupportedError }
|
98
|
-
end
|
99
|
-
end
|
100
|
-
|
101
|
-
it "supports basic authentication" do
|
102
|
-
request = HTTPI::Request.new(@server.url + "basic-auth")
|
103
|
-
request.auth.basic("admin", "secret")
|
104
|
-
|
105
|
-
response = HTTPI.get(request, adapter)
|
106
|
-
expect(response.body).to eq("basic-auth")
|
107
|
-
end
|
108
|
-
|
109
|
-
it "does not support digest authentication" do
|
110
|
-
request = HTTPI::Request.new(@server.url + "digest-auth")
|
111
|
-
request.auth.digest("admin", "secret")
|
112
|
-
|
113
|
-
expect { HTTPI.get(request, adapter) }.
|
114
|
-
to raise_error(HTTPI::NotSupportedError, /does not support HTTP digest authentication/)
|
115
|
-
end
|
116
|
-
|
117
|
-
it "supports ntlm authentication" do
|
118
|
-
request = HTTPI::Request.new(@server.url + "ntlm-auth")
|
119
|
-
request.auth.ntlm("tester", "vReqSoafRe5O")
|
120
|
-
|
121
|
-
response = HTTPI.get(request, adapter)
|
122
|
-
expect(response.body).to eq("ntlm-auth")
|
123
|
-
end
|
124
|
-
|
125
|
-
it 'does not support ntlm authentication when Net::NTLM is not available' do
|
126
|
-
Net.expects(:const_defined?).with(:NTLM).returns false
|
127
|
-
|
128
|
-
request = HTTPI::Request.new(@server.url + 'ntlm-auth')
|
129
|
-
request.auth.ntlm("testing", "failures")
|
130
|
-
|
131
|
-
expect { HTTPI.get(request, adapter) }.
|
132
|
-
to raise_error(HTTPI::NotSupportedError, /Net::NTLM is not available/)
|
133
|
-
end
|
134
|
-
|
135
|
-
it 'does not require ntlm when ntlm authenication is not requested' do
|
136
|
-
HTTPI::Adapter::NetHTTP.any_instance.stubs(:check_net_ntlm_version!).raises(RuntimeError)
|
137
|
-
request = HTTPI::Request.new(@server.url)
|
138
|
-
expect(request.auth.ntlm?).to be false
|
139
|
-
|
140
|
-
# make sure a request doesn't call ntlm check if we don't ask for it.
|
141
|
-
expect { HTTPI.get(request, adapter) }.not_to raise_error
|
142
|
-
HTTPI::Adapter::NetHTTP.any_instance.unstub(:check_net_ntlm_version!)
|
143
|
-
end
|
144
|
-
|
145
|
-
it 'does check ntlm when ntlm authentication is requested' do
|
146
|
-
request = HTTPI::Request.new(@server.url + "ntlm-auth")
|
147
|
-
request.auth.ntlm("tester", "vReqSoafRe5O")
|
148
|
-
|
149
|
-
expect { HTTPI.get(request, adapter) }.not_to raise_error
|
150
|
-
|
151
|
-
# the check should also verify that the version of ntlm is supported and still fail if it isn't
|
152
|
-
HTTPI::Adapter::NetHTTP.any_instance.stubs(:ntlm_version).returns("0.1.1")
|
153
|
-
|
154
|
-
request = HTTPI::Request.new(@server.url + "ntlm-auth")
|
155
|
-
request.auth.ntlm("tester", "vReqSoafRe5O")
|
156
|
-
|
157
|
-
expect { HTTPI.get(request, adapter) }.to raise_error(ArgumentError, /Invalid version/)
|
158
|
-
|
159
|
-
HTTPI::Adapter::NetHTTP.any_instance.unstub(:ntlm_version)
|
160
|
-
end
|
161
|
-
|
162
|
-
it "does not crash when authenticate header is missing (on second request)" do
|
163
|
-
request = HTTPI::Request.new(@server.url + 'ntlm-auth')
|
164
|
-
request.auth.ntlm("tester", "vReqSoafRe5O")
|
165
|
-
|
166
|
-
expect { HTTPI.get(request, adapter) }.
|
167
|
-
to_not raise_error
|
168
|
-
|
169
|
-
expect { HTTPI.get(request, adapter) }.
|
170
|
-
to_not raise_error
|
171
|
-
end
|
172
|
-
end
|
173
|
-
|
174
|
-
# it does not support digest auth
|
175
|
-
|
176
|
-
if RUBY_PLATFORM =~ /java/
|
177
|
-
pending "Puma Server complains: SSL not supported on JRuby"
|
178
|
-
else
|
179
|
-
context "https requests" do
|
180
|
-
before :all do
|
181
|
-
@server = IntegrationServer.run(:ssl => true)
|
182
|
-
end
|
183
|
-
after :all do
|
184
|
-
@server.stop
|
185
|
-
end
|
186
|
-
|
187
|
-
# it does not raise when no certificate was set up
|
188
|
-
it "works when set up properly" do
|
189
|
-
request = HTTPI::Request.new(@server.url)
|
190
|
-
request.auth.ssl.ca_cert_file = IntegrationServer.ssl_ca_file
|
191
|
-
|
192
|
-
response = HTTPI.get(request, adapter)
|
193
|
-
expect(response.body).to eq("get")
|
37
|
+
describe "write_timeout" do
|
38
|
+
if Net::HTTP.method_defined?(:write_timeout=)
|
39
|
+
it "is being set on the client" do
|
40
|
+
request.write_timeout = 50
|
41
|
+
adapter.client.expects(:write_timeout=).with(50)
|
42
|
+
adapter.request(:get)
|
43
|
+
end
|
44
|
+
else
|
45
|
+
it "can not be set on the client" do
|
46
|
+
request.write_timeout = 50
|
47
|
+
expect { adapter.request(:get) }
|
48
|
+
.to raise_error(HTTPI::NotSupportedError, /write_timeout/)
|
49
|
+
end
|
50
|
+
end
|
194
51
|
end
|
195
52
|
end
|
196
53
|
end
|
197
|
-
|
198
54
|
end
|
data/spec/httpi/auth/ssl_spec.rb
CHANGED
@@ -4,6 +4,7 @@ require "httpi/auth/ssl"
|
|
4
4
|
describe HTTPI::Auth::SSL do
|
5
5
|
before(:all) do
|
6
6
|
@ssl_versions = HTTPI::Auth::SSL::SSL_VERSIONS
|
7
|
+
@min_max_versions = HTTPI::Auth::SSL::MIN_MAX_VERSIONS
|
7
8
|
end
|
8
9
|
|
9
10
|
describe "VERIFY_MODES" do
|
@@ -158,6 +159,53 @@ describe HTTPI::Auth::SSL do
|
|
158
159
|
end
|
159
160
|
end
|
160
161
|
|
162
|
+
describe "#min_version" do
|
163
|
+
subject { HTTPI::Auth::SSL.new }
|
164
|
+
|
165
|
+
it "returns the min_version" do
|
166
|
+
subject.min_version = @min_max_versions.first
|
167
|
+
expect(subject.min_version).to eq(@min_max_versions.first)
|
168
|
+
end
|
169
|
+
|
170
|
+
it 'raises ArgumentError if the version is unsupported' do
|
171
|
+
expect { ssl.min_version = :ssl_fail }.
|
172
|
+
to raise_error(ArgumentError, "Invalid SSL min_version :ssl_fail\n" +
|
173
|
+
"Please specify one of #{@min_max_versions}")
|
174
|
+
end
|
175
|
+
end
|
176
|
+
|
177
|
+
describe "#max_version" do
|
178
|
+
subject { HTTPI::Auth::SSL.new }
|
179
|
+
|
180
|
+
it "returns the SSL version" do
|
181
|
+
subject.max_version = @min_max_versions.first
|
182
|
+
expect(subject.max_version).to eq(@min_max_versions.first)
|
183
|
+
end
|
184
|
+
|
185
|
+
it 'raises ArgumentError if the version is unsupported' do
|
186
|
+
expect { ssl.max_version = :ssl_fail }.
|
187
|
+
to raise_error(ArgumentError, "Invalid SSL max_version :ssl_fail\n" +
|
188
|
+
"Please specify one of #{@min_max_versions}")
|
189
|
+
end
|
190
|
+
end
|
191
|
+
|
192
|
+
describe '#ciphers' do
|
193
|
+
subject { ssl.ciphers }
|
194
|
+
let(:ssl) { HTTPI::Auth::SSL.new }
|
195
|
+
|
196
|
+
context 'without ciphers' do
|
197
|
+
before { ssl.ciphers = nil }
|
198
|
+
|
199
|
+
it { is_expected.to eq(nil) }
|
200
|
+
end
|
201
|
+
|
202
|
+
context 'with ciphers' do
|
203
|
+
before { ssl.ciphers = OpenSSL::SSL::SSLContext.new.ciphers }
|
204
|
+
|
205
|
+
it { is_expected.to be_any.and(all(be_an_instance_of(String))) }
|
206
|
+
end
|
207
|
+
end
|
208
|
+
|
161
209
|
def ssl
|
162
210
|
ssl = HTTPI::Auth::SSL.new
|
163
211
|
ssl.cert_key_file = "spec/fixtures/client_key.pem"
|
data/spec/httpi/httpi_spec.rb
CHANGED
@@ -6,11 +6,9 @@ require "excon"
|
|
6
6
|
require "net/http/persistent"
|
7
7
|
require "http"
|
8
8
|
|
9
|
-
unless
|
9
|
+
unless RUBY_PLATFORM =~ /java/
|
10
10
|
require "em-synchrony"
|
11
11
|
require "em-http-request"
|
12
|
-
end
|
13
|
-
unless RUBY_PLATFORM =~ /java/
|
14
12
|
require "curb"
|
15
13
|
end
|
16
14
|
|
@@ -294,7 +292,7 @@ describe HTTPI do
|
|
294
292
|
end
|
295
293
|
|
296
294
|
HTTPI::Adapter::ADAPTERS.each do |adapter, opts|
|
297
|
-
unless (adapter == :em_http
|
295
|
+
unless (adapter == :em_http || adapter == :curb) && RUBY_PLATFORM =~ /java/
|
298
296
|
client_class = {
|
299
297
|
:httpclient => lambda { HTTPClient },
|
300
298
|
:curb => lambda { Curl::Easy },
|
@@ -33,6 +33,17 @@ describe HTTPI::Adapter::Curb do
|
|
33
33
|
expect(response.headers["Set-Cookie"]).to eq(cookies)
|
34
34
|
end
|
35
35
|
|
36
|
+
it "it supports read timeout" do
|
37
|
+
require "curb"
|
38
|
+
|
39
|
+
request = HTTPI::Request.new(@server.url + "timeout")
|
40
|
+
request.read_timeout = 0.5 # seconds
|
41
|
+
|
42
|
+
expect do
|
43
|
+
HTTPI.get(request, adapter)
|
44
|
+
end.to raise_exception(Curl::Err::TimeoutError)
|
45
|
+
end
|
46
|
+
|
36
47
|
it "executes GET requests" do
|
37
48
|
response = HTTPI.get(@server.url, adapter)
|
38
49
|
expect(response.body).to eq("get")
|
@@ -112,6 +123,15 @@ describe HTTPI::Adapter::Curb do
|
|
112
123
|
response = HTTPI.get(request, adapter)
|
113
124
|
expect(response.body).to eq("get")
|
114
125
|
end
|
126
|
+
|
127
|
+
it "works with ciphers" do
|
128
|
+
request = HTTPI::Request.new(@server.url)
|
129
|
+
request.auth.ssl.ca_cert_file = IntegrationServer.ssl_ca_file
|
130
|
+
request.auth.ssl.ciphers = OpenSSL::SSL::SSLContext.new.ciphers
|
131
|
+
|
132
|
+
response = HTTPI.get(request, adapter)
|
133
|
+
expect(response.body).to eq("get")
|
134
|
+
end
|
115
135
|
end
|
116
136
|
|
117
137
|
end
|
@@ -3,8 +3,8 @@ require "integration/support/server"
|
|
3
3
|
|
4
4
|
describe HTTPI::Adapter::EmHttpRequest do
|
5
5
|
|
6
|
-
# em_http is not supported on
|
7
|
-
unless
|
6
|
+
# em_http is not supported on java
|
7
|
+
unless RUBY_PLATFORM =~ /java/
|
8
8
|
require "em-synchrony"
|
9
9
|
|
10
10
|
subject(:adapter) { :em_http }
|
@@ -42,6 +42,23 @@ describe HTTPI::Adapter::EmHttpRequest do
|
|
42
42
|
expect(response.headers["Set-Cookie"]).to eq(cookies)
|
43
43
|
end
|
44
44
|
|
45
|
+
if RUBY_PLATFORM =~ /java/
|
46
|
+
pending <<-MSG
|
47
|
+
It seems like JRuby is missing support for inactivity timeout! See related issues on GitHub:
|
48
|
+
- https://github.com/eventmachine/eventmachine/issues/155
|
49
|
+
- https://github.com/eventmachine/eventmachine/pull/312
|
50
|
+
MSG
|
51
|
+
else
|
52
|
+
it "it supports read timeout" do
|
53
|
+
request = HTTPI::Request.new(@server.url + "timeout")
|
54
|
+
request.read_timeout = 0.5 # seconds
|
55
|
+
|
56
|
+
expect do
|
57
|
+
HTTPI.get(request, adapter)
|
58
|
+
end.to raise_exception(HTTPI::TimeoutError)
|
59
|
+
end
|
60
|
+
end
|
61
|
+
|
45
62
|
it "executes GET requests" do
|
46
63
|
response = HTTPI.get(@server.url, adapter)
|
47
64
|
expect(response.body).to eq("get")
|
@@ -1,7 +1,7 @@
|
|
1
1
|
require "spec_helper"
|
2
2
|
require "integration/support/server"
|
3
3
|
|
4
|
-
describe HTTPI::Adapter::
|
4
|
+
describe HTTPI::Adapter::Excon do
|
5
5
|
|
6
6
|
subject(:adapter) { :excon }
|
7
7
|
|
@@ -30,6 +30,17 @@ describe HTTPI::Adapter::HTTPClient do
|
|
30
30
|
expect(response.headers["Set-Cookie"]).to eq(cookies)
|
31
31
|
end
|
32
32
|
|
33
|
+
it "it supports read timeout" do
|
34
|
+
require "excon"
|
35
|
+
|
36
|
+
request = HTTPI::Request.new(@server.url + "timeout")
|
37
|
+
request.read_timeout = 0.5 # seconds
|
38
|
+
|
39
|
+
expect do
|
40
|
+
HTTPI.get(request, adapter)
|
41
|
+
end.to raise_exception(Excon::Error::Timeout)
|
42
|
+
end
|
43
|
+
|
33
44
|
it "executes GET requests" do
|
34
45
|
response = HTTPI.get(@server.url, adapter)
|
35
46
|
expect(response.body).to eq("get")
|
@@ -68,6 +79,21 @@ describe HTTPI::Adapter::HTTPClient do
|
|
68
79
|
expect(response.body).to eq("basic-auth")
|
69
80
|
end
|
70
81
|
|
82
|
+
it "does not support ntlm authentication" do
|
83
|
+
request = HTTPI::Request.new(@server.url + "ntlm-auth")
|
84
|
+
request.auth.ntlm("tester", "vReqSoafRe5O")
|
85
|
+
|
86
|
+
expect { HTTPI.get(request, adapter) }.
|
87
|
+
to raise_error(HTTPI::NotSupportedError, /does not support NTLM authentication/)
|
88
|
+
end
|
89
|
+
|
90
|
+
it "supports disabling verify mode" do
|
91
|
+
request = HTTPI::Request.new(@server.url)
|
92
|
+
request.auth.ssl.verify_mode = :none
|
93
|
+
adapter_class = HTTPI::Adapter.load(adapter).new(request)
|
94
|
+
expect(adapter_class.client.data[:ssl_verify_peer]).to eq(false)
|
95
|
+
end
|
96
|
+
|
71
97
|
it "supports chunked response" do
|
72
98
|
request = HTTPI::Request.new(@server.url)
|
73
99
|
res = ""
|
@@ -102,6 +128,46 @@ describe HTTPI::Adapter::HTTPClient do
|
|
102
128
|
response = HTTPI.get(request, adapter)
|
103
129
|
expect(response.body).to eq("get")
|
104
130
|
end
|
131
|
+
|
132
|
+
it "works with min_version/max_version" do
|
133
|
+
request = HTTPI::Request.new(@server.url)
|
134
|
+
request.auth.ssl.ca_cert_file = IntegrationServer.ssl_ca_file
|
135
|
+
request.auth.ssl.min_version = :TLS1_2
|
136
|
+
request.auth.ssl.max_version = :TLS1_2
|
137
|
+
|
138
|
+
response = HTTPI.get(request, adapter)
|
139
|
+
expect(response.body).to eq("get")
|
140
|
+
end
|
141
|
+
|
142
|
+
it "works with client cert and key provided as file path" do
|
143
|
+
request = HTTPI::Request.new(@server.url)
|
144
|
+
request.auth.ssl.ca_cert_file = IntegrationServer.ssl_ca_file
|
145
|
+
request.auth.ssl.cert_file = "spec/fixtures/client_cert.pem"
|
146
|
+
request.auth.ssl.cert_key_file = "spec/fixtures/client_key.pem"
|
147
|
+
|
148
|
+
response = HTTPI.get(request, adapter)
|
149
|
+
expect(response.body).to eq("get")
|
150
|
+
end
|
151
|
+
|
152
|
+
it "works with client cert and key set directly" do
|
153
|
+
request = HTTPI::Request.new(@server.url)
|
154
|
+
|
155
|
+
request.auth.ssl.ca_cert_file = IntegrationServer.ssl_ca_file
|
156
|
+
request.auth.ssl.cert = OpenSSL::X509::Certificate.new File.open("spec/fixtures/client_cert.pem").read
|
157
|
+
request.auth.ssl.cert_key = OpenSSL::PKey.read File.open("spec/fixtures/client_key.pem").read
|
158
|
+
|
159
|
+
response = HTTPI.get(request, adapter)
|
160
|
+
expect(response.body).to eq("get")
|
161
|
+
end
|
162
|
+
|
163
|
+
it "works with ciphers" do
|
164
|
+
request = HTTPI::Request.new(@server.url)
|
165
|
+
request.auth.ssl.ca_cert_file = IntegrationServer.ssl_ca_file
|
166
|
+
request.auth.ssl.ciphers = OpenSSL::SSL::SSLContext.new.ciphers
|
167
|
+
|
168
|
+
response = HTTPI.get(request, adapter)
|
169
|
+
expect(response.body).to eq("get")
|
170
|
+
end
|
105
171
|
end
|
106
172
|
end
|
107
173
|
|
@@ -1,44 +1,19 @@
|
|
1
1
|
-----BEGIN CERTIFICATE-----
|
2
|
-
|
3
|
-
|
4
|
-
|
5
|
-
|
6
|
-
|
7
|
-
|
8
|
-
|
9
|
-
|
10
|
-
|
11
|
-
|
12
|
-
|
13
|
-
|
14
|
-
|
15
|
-
|
16
|
-
|
17
|
-
|
18
|
-
|
19
|
-
MJJFRkSu6d/Ph5ypzBVw2YMT/nsOo5VwMUGLgS7YVjU+u/HNWz80J3oO17mNZllj
|
20
|
-
PvORJcnjwlroDnS58KoJ7GDgejv3ESWADvX1OHLE4cRkiQGeLoEU4pxdCxXRqX0U
|
21
|
-
PbwIkZN9mXVcrmPHq8MWi4eC/V7hnbZETMHuWhUoiNdOEfsAXr3iP4KjyyRdwc7a
|
22
|
-
d/xgcK06UVQRL/HbEYGiQL056mc=
|
23
|
-
-----END CERTIFICATE-----
|
24
|
-
-----BEGIN CERTIFICATE-----
|
25
|
-
MIIDaDCCAlCgAwIBAgIBATANBgkqhkiG9w0BAQ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