httpi 2.4.5 → 2.5.0

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: d4ef171693207d4179542cd91eb6de5c8a1dc4b30458fcb5e255098e60a6297e
4
- data.tar.gz: fb6977168d9ad78ab44fdfcbce528145fbe4c43f433a195cd6cd1ca5e33f1f54
3
+ metadata.gz: 2c921690b77440f26fa4da9bac58ed74d16440e9df7d180be606e1c21460dfbb
4
+ data.tar.gz: d95e355e1925d7cb78622fc6188cc761eedec15e30ad9bd93b565937873d86c6
5
5
  SHA512:
6
- metadata.gz: fb1092a0fb53a39f2d7f327b0f7c02b914f8f1e1f80f20e64178592d81b98d414016a62310a532931c3ba0da969f9fde269da22ea62fb594220f111a351e64ba
7
- data.tar.gz: 5ce7bd00cb3ed67cace0e21ca2a4b459f6da89d618da1857b641a37413a0da98b5619b617dd86fab0a68ba280713a24d4ab54ae6b44362b91c3bc04df43a9e3a
6
+ metadata.gz: '09c5e6e4bf5242de2f9472123c94ca3f17a3fd60e816886cf7402d4d977d45e2cc8be98e3d6a4ac2c7d16b68af8cef58a016d4b1b4aa443bfca92bde6f7232ce'
7
+ data.tar.gz: ba7d999bc0d771365a4c647df38419f7ba2ee22f3d06c33dd660645aad999d7529d1ce8036b9d2d24994098fcdf2f415df2b533b4c68c5c1a483b0e25862629a
@@ -0,0 +1,48 @@
1
+ name: Development
2
+
3
+ on: [push, pull_request]
4
+
5
+ jobs:
6
+ test:
7
+ name: ${{matrix.ruby}} on ${{matrix.os}}
8
+ runs-on: ${{matrix.os}}-latest
9
+ continue-on-error: ${{matrix.experimental}}
10
+
11
+ strategy:
12
+ matrix:
13
+ os:
14
+ - ubuntu
15
+
16
+ ruby:
17
+ - "2.6"
18
+ - "2.7"
19
+ - "3.0"
20
+
21
+ experimental: [false]
22
+ env: [""]
23
+
24
+ include:
25
+ - os: ubuntu
26
+ ruby: truffleruby
27
+ experimental: true
28
+ - os: ubuntu
29
+ ruby: jruby
30
+ experimental: true
31
+ - os: ubuntu
32
+ ruby: head
33
+ experimental: true
34
+
35
+ steps:
36
+ - uses: actions/checkout@v2
37
+
38
+ - name: Install dependencies
39
+ run: sudo apt-get install libcurl4-openssl-dev
40
+
41
+ - uses: ruby/setup-ruby@v1
42
+ with:
43
+ ruby-version: ${{matrix.ruby}}
44
+ bundler-cache: true
45
+
46
+ - name: Run tests
47
+ timeout-minutes: 5
48
+ run: ${{matrix.env}} bundle exec rspec
data/CHANGELOG.md CHANGED
@@ -1,7 +1,12 @@
1
+ ### 2.5.0 (2021-10-05)
2
+
3
+ * Feature: [#214](https://github.com/savonrb/httpi/pull/214) Add SSL ciphers configuration
4
+ * Improvement: [#227](https://github.com/savonrb/httpi/pull/227) Use GitHub Actions as CI. Require at least Ruby v2.3.
5
+
1
6
  ### 2.4.5
2
7
 
3
8
  * Improvement: [#209](https://github.com/savonrb/httpi/pull/209) Drop Travis CI support for Ruby < 2.3.0 and jruby.
4
- * Feature: [#208](https://github.com/savonrb/httpi/pull/208) Add SSL min/max_version configuration for supporting adapters
9
+ * Feature: [#208](https://github.com/savonrb/httpi/pull/208) Add SSL min/max_version configuration for supporting adapters
5
10
  * Improvement: [#206](https://github.com/savonrb/httpi/pull/206) Support for net-http-persistent v3
6
11
  * Improvement: [#204](https://github.com/savonrb/httpi/pull/204) Avoid excon warning
7
12
 
data/Gemfile CHANGED
@@ -3,18 +3,20 @@ gemspec
3
3
 
4
4
  gem 'jruby-openssl', :platforms => :jruby
5
5
 
6
- # compatibility restrictions for http clients under existing travis test environments
7
- gem 'public_suffix', '~> 2.0' # or remove rubies < 2.1 from travis.yml
6
+ gem 'public_suffix', '~> 4.0'
8
7
 
9
8
  # http clients
10
9
  gem 'httpclient', '~> 2.3', :require => false
11
- gem 'curb', '~> 0.8', :require => false, :platforms => :ruby
12
- gem 'em-http-request', :require => false, :platforms => [:ruby, :jruby]
10
+ gem 'curb', '~> 0.8', :require => false, :platforms => [:ruby]
11
+ gem 'em-http-request', :require => false, :platforms => [:ruby]
13
12
  gem 'em-synchrony', :require => false, :platforms => [:ruby, :jruby]
14
13
  gem 'excon', '~> 0.21', :require => false, :platforms => [:ruby, :jruby]
15
- gem 'net-http-persistent', '~> 2.8', :require => false
14
+ gem 'net-http-persistent', '~> 4.0', :require => false
16
15
  gem 'http', :require => false
17
16
 
17
+ # adapter extensions
18
+ gem 'rack'
19
+ gem 'socksify'
20
+
18
21
  # coverage
19
22
  gem 'simplecov', :require => false
20
- gem 'coveralls', :require => false
data/README.md CHANGED
@@ -5,11 +5,7 @@ A common interface for Ruby's HTTP libraries.
5
5
  [Documentation](https://www.rubydoc.info/gems/httpi) |
6
6
  [Mailing list](https://groups.google.com/forum/#!forum/httpirb)
7
7
 
8
- [![Build Status](https://secure.travis-ci.org/savonrb/httpi.svg?branch=master)](http://travis-ci.org/savonrb/httpi)
9
- [![Gem Version](https://badge.fury.io/rb/httpi.svg)](http://badge.fury.io/rb/httpi)
10
- [![Code Climate](https://codeclimate.com/github/savonrb/httpi.svg)](https://codeclimate.com/github/savonrb/httpi)
11
- [![Coverage Status](https://coveralls.io/repos/savonrb/httpi/badge.svg?branch=master)](https://coveralls.io/r/savonrb/httpi)
12
-
8
+ [![Development](https://github.com/savonrb/httpi/actions/workflows/development.yml/badge.svg)](https://github.com/savonrb/httpi/actions/workflows/development.yml)
13
9
 
14
10
  ## Installation
15
11
 
@@ -28,7 +24,6 @@ gem 'httpi', '~> 2.1.0'
28
24
 
29
25
  ## Usage example
30
26
 
31
-
32
27
  ``` ruby
33
28
  require "httpi"
34
29
 
data/httpi.gemspec CHANGED
@@ -11,7 +11,8 @@ Gem::Specification.new do |s|
11
11
  s.homepage = "http://github.com/savonrb/#{s.name}"
12
12
  s.summary = "Common interface for Ruby's HTTP libraries"
13
13
  s.description = s.summary
14
- s.required_ruby_version = '>= 1.9.2'
14
+
15
+ s.required_ruby_version = '>= 2.3'
15
16
 
16
17
  s.license = 'MIT'
17
18
 
@@ -19,10 +20,10 @@ Gem::Specification.new do |s|
19
20
  s.add_dependency 'socksify'
20
21
 
21
22
  s.add_development_dependency 'rubyntlm', '~> 0.3.2'
22
- s.add_development_dependency 'rake', '~> 10.0'
23
- s.add_development_dependency 'rspec', '~> 2.14'
23
+ s.add_development_dependency 'rake', '~> 13.0'
24
+ s.add_development_dependency 'rspec', '~> 3.5'
24
25
  s.add_development_dependency 'mocha', '~> 0.13'
25
- s.add_development_dependency 'puma', '~> 2.3.2'
26
+ s.add_development_dependency 'puma', '~> 5.0'
26
27
  s.add_development_dependency 'webmock'
27
28
 
28
29
  s.files = `git ls-files`.split("\n")
@@ -116,6 +116,7 @@ module HTTPI
116
116
  @client.cert_key = ssl.cert_key_file
117
117
  @client.cert = ssl.cert_file
118
118
  @client.certpassword = ssl.cert_key_password
119
+ @client.set(:ssl_cipher_list, ssl.ciphers.join(':')) if ssl.ciphers
119
120
 
120
121
  @client.ssl_verify_peer = ssl.verify_mode == :peer
121
122
  end
@@ -73,6 +73,7 @@ module HTTPI
73
73
  opts[:ssl_verify_peer] = false
74
74
  end
75
75
 
76
+ opts[:ciphers] = ssl.ciphers if ssl.ciphers
76
77
  opts[:ssl_version] = ssl.ssl_version if ssl.ssl_version
77
78
  opts[:ssl_min_version] = ssl.min_version if ssl.min_version
78
79
  opts[:ssl_max_version] = ssl.max_version if ssl.max_version
@@ -61,6 +61,7 @@ module HTTPI
61
61
  context.min_version = @request.auth.ssl.min_version if @request.auth.ssl.min_version != nil
62
62
  context.max_version = @request.auth.ssl.max_version if @request.auth.ssl.max_version != nil
63
63
  context.verify_mode = @request.auth.ssl.openssl_verify_mode
64
+ context.ciphers = @request.auth.ssl.ciphers if @request.auth.ssl.ciphers
64
65
 
65
66
  client = ::HTTP::Client.new(:ssl_context => context)
66
67
  else
@@ -73,6 +73,7 @@ module HTTPI
73
73
  # Send client-side certificate regardless of state of SSL verify mode
74
74
  @client.ssl_config.client_cert = ssl.cert
75
75
  @client.ssl_config.client_key = ssl.cert_key
76
+ @client.ssl_config.ciphers = ssl.ciphers if ssl.ciphers
76
77
 
77
78
  @client.ssl_config.verify_mode = ssl.openssl_verify_mode
78
79
  end
@@ -177,6 +177,7 @@ module HTTPI
177
177
  # Send client-side certificate regardless of state of SSL verify mode
178
178
  @client.key = ssl.cert_key
179
179
  @client.cert = ssl.cert
180
+ @client.ciphers = ssl.ciphers if ssl.ciphers
180
181
 
181
182
  @client.verify_mode = ssl.openssl_verify_mode
182
183
  end
@@ -12,7 +12,7 @@ module HTTPI
12
12
  private
13
13
 
14
14
  def create_client
15
- if is_v3
15
+ if Gem::Version.new(Net::HTTP::Persistent::VERSION) >= Gem::Version.new('3.0.0')
16
16
  Net::HTTP::Persistent.new name: thread_key
17
17
  else
18
18
  Net::HTTP::Persistent.new thread_key
@@ -42,11 +42,6 @@ module HTTPI
42
42
  def thread_key
43
43
  @request.url.host.split(/\W/).reject{|p|p == ""}.join('-')
44
44
  end
45
-
46
- def is_v3
47
- Net::HTTP::Persistent::VERSION.start_with? "3."
48
- end
49
-
50
45
  end
51
46
  end
52
47
  end
@@ -25,7 +25,7 @@ module HTTPI
25
25
 
26
26
  # Returns whether SSL configuration is present.
27
27
  def present?
28
- (verify_mode == :none) || (cert && cert_key) || ca_cert_file
28
+ (verify_mode == :none) || (cert && cert_key) || ca_cert_file || ciphers
29
29
  rescue TypeError, Errno::ENOENT
30
30
  false
31
31
  end
@@ -48,6 +48,24 @@ module HTTPI
48
48
  # Certificate store holds trusted CA certificates used to verify peer certificates.
49
49
  attr_accessor :cert_store
50
50
 
51
+ # Accessor for the SSL ciphers list.
52
+ attr_reader :ciphers
53
+
54
+ # Sets the available symmetric algorithms for encryption and decryption.
55
+ # @see OpenSSL::SSL::SSLContext#ciphers
56
+ # @example
57
+ # ssl.ciphers = "cipher1:cipher2:..."
58
+ # ssl.ciphers = [name, ...]
59
+ # ssl.ciphers = [[name, version, bits, alg_bits], ...]
60
+ def ciphers=(ciphers)
61
+ @ciphers =
62
+ if ciphers
63
+ context = OpenSSL::SSL::SSLContext.new
64
+ context.ciphers = ciphers
65
+ context.ciphers.map(&:first)
66
+ end
67
+ end
68
+
51
69
  # Returns the cert type to validate SSL certificates PEM|DER.
52
70
  def cert_type
53
71
  @cert_type ||= :pem
data/lib/httpi/version.rb CHANGED
@@ -1,3 +1,3 @@
1
1
  module HTTPI
2
- VERSION = '2.4.5'
2
+ VERSION = '2.5.0'
3
3
  end
@@ -1,16 +1,20 @@
1
1
  -----BEGIN CERTIFICATE-----
2
- MIICbTCCAdYCCQDC4v8d04615DANBgkqhkiG9w0BAQUFADB7MQswCQYDVQQGEwJE
3
- RTEQMA4GA1UECBMHSGFtYnVyZzEQMA4GA1UEBxMHSGFtYnVyZzEOMAwGA1UEChMF
4
- aHR0cGkxFDASBgNVBAMTC2V4YW1wbGUuY29tMSIwIAYJKoZIhvcNAQkBFhNleGFt
5
- cGxlQGV4YW1wbGUuY29tMB4XDTEwMTAxNTE4NTg0N1oXDTExMTAxNTE4NTg0N1ow
6
- ezELMAkGA1UEBhMCREUxEDAOBgNVBAgTB0hhbWJ1cmcxEDAOBgNVBAcTB0hhbWJ1
7
- cmcxDjAMBgNVBAoTBWh0dHBpMRQwEgYDVQQDEwtleGFtcGxlLmNvbTEiMCAGCSqG
8
- SIb3DQEJARYTZXhhbXBsZUBleGFtcGxlLmNvbTCBnzANBgkqhkiG9w0BAQEFAAOB
9
- jQAwgYkCgYEAvJiaojIFQAbFczXkBmjxpxra9LbQm0VIESFSl8uBSjmG/gmCBwKg
10
- 8O94P3tAjDNClC+fEqBLE37KH4qe76yw7upgRruP5jQzUEL1yCaVtA/DoqgaCxZy
11
- 7VhB2A3f71Zw6kQPt3BOME68fnGsTX65x9XAawCGzGmJSk/Z6wvml1MCAwEAATAN
12
- BgkqhkiG9w0BAQUFAAOBgQCxOyni9LOKf17vUKVG8Y4TBzRYwm8/hlEdVEU3JKG0
13
- /aCCwIJLHl+z+3L4r81IN3+YKrHilqx9K0emboJbBRQklYs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kDW7hn1NAoGBAONe
16
+ dfmO49s2y1Ye2XrRCmGqfVa0n4pFmQajgputc4BPkf3XudtH365O0QEwt54Nw3dQ
17
+ IvFzq/f0XVhkw4Coo38WZ4nTctbW/ZkVvKJnk2DJE1ubNJvw1wHzwz848BVT/b4Z
18
+ VplqNDPvWmEmGFzrLeOwPZfDcglDxaCpjF7q0GqTAoGAcEOjUHJuxjvqpceR4NVL
19
+ vwfqXhRecWMlXJZiaqhzFrfkB4m9D98+/3I/bdesRXrWaNAbgv+GfpmB8X65SHzT
20
+ zht9hEvn6A1LdX0KfIDKzeMCc49qY49N6ZgQNVnsW7DiZLAyMVbz5Hc1oNhHnWXg
21
+ lHQfbUsbfeQjh2Q6YVMpZxkCgYAmC2pGJciup46CjIrraAsKqJJsbbC8XETsvXNf
22
+ RTisYaQWC4DH1lDxQ7LpNhOjWL46Oqh+KlK+HJ956PJlltI0s7UDdOQkWrj4YpC7
23
+ xAT/DuY0T9YPuc7gPr+O1qIlj3ZH1smMxh6SChzfYJZ3BcsZ7CWCPWvZbQOmjHg2
24
+ cagKDQKBgQCjuICU3aElEXyGwPCEazVakgcuAuiAAjECQrHrbSVPaTDu6Cumupkw
25
+ 50ypk/qJ3DegEumpufwLg37A9yFogkkHBI9Sw0PVjzXM0iWJsHceLTHWUgJBWcl3
26
+ 5Sl/AacXbUHz4NMqARNVrfR3DP33Z/YXJ4bpsVswEjD51jPwwluwyA==
15
27
  -----END RSA PRIVATE KEY-----
@@ -250,6 +250,13 @@ unless RUBY_PLATFORM =~ /java/
250
250
  request
251
251
  end
252
252
 
253
+ it 'sets ssl_cipher_list' do
254
+ request.auth.ssl.ciphers = ["AES128"]
255
+ curb.expects(:set).with(any_parameters).at_least(1)
256
+ curb.expects(:set).with(:ssl_cipher_list, anything)
257
+ adapter.request(:get)
258
+ end
259
+
253
260
  context 'sets ssl_version' do
254
261
  it 'defaults to nil when no ssl_version is specified' do
255
262
  curb.expects(:ssl_version=).with(nil)
@@ -2,7 +2,7 @@ require "spec_helper"
2
2
  require "httpi/adapter/em_http"
3
3
  require "httpi/request"
4
4
 
5
- begin
5
+ unless RUBY_PLATFORM =~ /java/
6
6
  HTTPI::Adapter.load_adapter(:em_http)
7
7
 
8
8
  describe HTTPI::Adapter::EmHttpRequest do
@@ -150,7 +150,7 @@ begin
150
150
 
151
151
  it "raises an error for HTTP digest auth" do
152
152
  request.auth.digest "username", "password"
153
- expect { adapter.request(:get) }.to raise_error
153
+ expect { adapter.request(:get) }.to raise_error HTTPI::NotSupportedError
154
154
  end
155
155
  end
156
156
 
@@ -177,10 +177,4 @@ begin
177
177
  end
178
178
 
179
179
  end
180
- rescue LoadError => e
181
- if e.message =~ /fiber/
182
- warn "LoadError: #{e.message} (EventMachine requires fibers)"
183
- else
184
- raise e
185
- end
186
180
  end
@@ -141,6 +141,13 @@ describe HTTPI::Adapter::HTTPClient do
141
141
 
142
142
  adapter.request(:get)
143
143
  end
144
+
145
+ it 'should set the ciphers if specified' do
146
+ request.auth.ssl.ciphers = OpenSSL::SSL::SSLContext.new.ciphers
147
+ ssl_config.expects(:ciphers=).with(request.auth.ssl.ciphers)
148
+
149
+ adapter.request(:get)
150
+ end
144
151
  end
145
152
 
146
153
  context "(for SSL client auth)" do
@@ -189,6 +189,23 @@ describe HTTPI::Auth::SSL do
189
189
  end
190
190
  end
191
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
+
192
209
  def ssl
193
210
  ssl = HTTPI::Auth::SSL.new
194
211
  ssl.cert_key_file = "spec/fixtures/client_key.pem"
@@ -6,11 +6,9 @@ require "excon"
6
6
  require "net/http/persistent"
7
7
  require "http"
8
8
 
9
- unless RUBY_VERSION < "1.9"
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 && RUBY_VERSION =~ /1\.8/) || (adapter == :curb && RUBY_PLATFORM =~ /java/)
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 },
@@ -123,6 +123,15 @@ describe HTTPI::Adapter::Curb do
123
123
  response = HTTPI.get(request, adapter)
124
124
  expect(response.body).to eq("get")
125
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
126
135
  end
127
136
 
128
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 ruby 1.8
7
- unless RUBY_VERSION =~ /1\.8/
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 }
@@ -1,7 +1,7 @@
1
1
  require "spec_helper"
2
2
  require "integration/support/server"
3
3
 
4
- describe HTTPI::Adapter::HTTPClient do
4
+ describe HTTPI::Adapter::Excon do
5
5
 
6
6
  subject(:adapter) { :excon }
7
7
 
@@ -159,6 +159,15 @@ describe HTTPI::Adapter::HTTPClient do
159
159
  response = HTTPI.get(request, adapter)
160
160
  expect(response.body).to eq("get")
161
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
162
171
  end
163
172
  end
164
173
 
@@ -1,44 +1,19 @@
1
1
  -----BEGIN CERTIFICATE-----
2
- MIID0DCCArigAwIBAgIBADANBgkqhkiG9w0BAQUFADA8MQswCQYDVQQGDAJKUDES
3
- MBAGA1UECgwJSklOLkdSLkpQMQwwCgYDVQQLDANSUlIxCzAJBgNVBAMMAkNBMB4X
4
- DTA0MDEzMDAwNDIzMloXDTM2MDEyMjAwNDIzMlowPDELMAkGA1UEBgwCSlAxEjAQ
5
- BgNVBAoMCUpJTi5HUi5KUDEMMAoGA1UECwwDUlJSMQswCQYDVQQDDAJDQTCCASIw
6
- DQYJKoZIhvcNAQEBBQADggEPADCCAQoCggEBANbv0x42BTKFEQOE+KJ2XmiSdZpR
7
- wjzQLAkPLRnLB98tlzs4xo+y4RyY/rd5TT9UzBJTIhP8CJi5GbS1oXEerQXB3P0d
8
- L5oSSMwGGyuIzgZe5+vZ1kgzQxMEKMMKlzA73rbMd4Jx3u5+jdbP0EDrPYfXSvLY
9
- bS04n2aX7zrN3x5KdDrNBfwBio2/qeaaj4+9OxnwRvYP3WOvqdW0h329eMfHw0pi
10
- JI0drIVdsEqClUV4pebT/F+CPUPkEh/weySgo9wANockkYu5ujw2GbLFcO5LXxxm
11
- dEfcVr3r6t6zOA4bJwL0W/e6LBcrwiG/qPDFErhwtgTLYf6Er67SzLyA66UCAwEA
12
- AaOB3DCB2TAPBgNVHRMBAf8EBTADAQH/MDEGCWCGSAGG+EIBDQQkFiJSdWJ5L09w
13
- ZW5TU0wgR2VuZXJhdGVkIENlcnRpZmljYXRlM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3bwZtIl+shf6GLgeRpWhj3TBnMhIlWnB/kpiiq8i0Tw7URo
20
+ 9H+9IqRcNqTbX2ebeXjOCc+5DkLp4LQq83OmRsM1R+HTTtC4ipb9cucqpA1HOftp
21
+ z5isGq3ctdXaxP8YsLuPcw1RAoGAXZx0W70ryy2JAJidbd55Hiq17ktOHumOzO2x
22
+ Qw+Lt9Lz2NqlJnXxCruVC9miwUJ3hPl93/iN21hRk6GJ7qFxDcda7nz3C5LTCzZd
23
+ LR4fKfTTxBKGPb6QHpDpbmpRmZECHqZOjCzoVMyBCf2JST/VUbkWqKLso4uhIidb
24
+ yRCbSmECgYEAp+IuwpnMxVPxP52/xPFVcAxH2pDfmn5TJLJCNuKEUAS9ncZuz7rh
25
+ jJxtbC4AoGsS0+TdxnlMBvBpZE3QddQmjvey77yu/OvRUX2m/J/d+I2duTaHGR9Z
26
+ 9VMxtlFY+DbDkJI2HVVxu5XfLKMJSEsMza8K64Ntx3XY3dJLCHrR1EY=
15
27
  -----END RSA PRIVATE KEY-----
@@ -141,6 +141,15 @@ describe HTTPI::Adapter::HTTP do
141
141
  response = HTTPI.get(request, adapter)
142
142
  expect(response.body).to eq("get")
143
143
  end
144
+
145
+ it "works with ciphers" do
146
+ request = HTTPI::Request.new(@server.url)
147
+ request.auth.ssl.ca_cert_file = IntegrationServer.ssl_ca_file
148
+ request.auth.ssl.ciphers = OpenSSL::SSL::SSLContext.new.ciphers
149
+
150
+ response = HTTPI.get(request, adapter)
151
+ expect(response.body).to eq("get")
152
+ end
144
153
  end
145
154
  end
146
155
 
@@ -121,6 +121,15 @@ describe HTTPI::Adapter::HTTPClient do
121
121
  response = HTTPI.get(request, adapter)
122
122
  expect(response.body).to eq("get")
123
123
  end
124
+
125
+ it "works with ciphers" do
126
+ request = HTTPI::Request.new(@server.url)
127
+ request.auth.ssl.ca_cert_file = IntegrationServer.ssl_ca_file
128
+ request.auth.ssl.ciphers = OpenSSL::SSL::SSLContext.new.ciphers
129
+
130
+ response = HTTPI.get(request, adapter)
131
+ expect(response.body).to eq("get")
132
+ end
124
133
  end
125
134
  end
126
135
 
@@ -1,7 +1,8 @@
1
1
  require "spec_helper"
2
2
  require "integration/support/server"
3
+ require "net/http/persistent"
3
4
 
4
- describe HTTPI::Adapter::NetHTTP do
5
+ describe HTTPI::Adapter::NetHTTPPersistent do
5
6
 
6
7
  subject(:adapter) { :net_http_persistent }
7
8
 
@@ -38,7 +39,7 @@ describe HTTPI::Adapter::NetHTTP do
38
39
 
39
40
  expect do
40
41
  HTTPI.get(request, adapter)
41
- end.to raise_exception(Net::HTTP::Persistent::Error, /Net::ReadTimeout/)
42
+ end.to raise_exception(Net::ReadTimeout)
42
43
  end
43
44
 
44
45
  it "executes GET requests" do
@@ -110,6 +111,7 @@ describe HTTPI::Adapter::NetHTTP do
110
111
  before :all do
111
112
  @server = IntegrationServer.run(:ssl => true)
112
113
  end
114
+
113
115
  after :all do
114
116
  @server.stop
115
117
  end
@@ -122,6 +124,15 @@ describe HTTPI::Adapter::NetHTTP do
122
124
  response = HTTPI.get(request, adapter)
123
125
  expect(response.body).to eq("get")
124
126
  end
127
+
128
+ it "works with ciphers" do
129
+ request = HTTPI::Request.new(@server.url)
130
+ request.auth.ssl.ca_cert_file = IntegrationServer.ssl_ca_file
131
+ request.auth.ssl.ciphers = OpenSSL::SSL::SSLContext.new.ciphers
132
+
133
+ response = HTTPI.get(request, adapter)
134
+ expect(response.body).to eq("get")
135
+ end
125
136
  end
126
137
  end
127
138
 
@@ -227,6 +227,15 @@ describe HTTPI::Adapter::NetHTTP do
227
227
  response = HTTPI.get(request, adapter)
228
228
  expect(response.body).to eq("get")
229
229
  end
230
+
231
+ it "works with ciphers" do
232
+ request = HTTPI::Request.new(@server.url)
233
+ request.auth.ssl.ca_cert_file = IntegrationServer.ssl_ca_file
234
+ request.auth.ssl.ciphers = OpenSSL::SSL::SSLContext.new.ciphers
235
+
236
+ response = HTTPI.get(request, adapter)
237
+ expect(response.body).to eq("get")
238
+ end
230
239
  end
231
240
  end
232
241
 
@@ -4,7 +4,6 @@ require "puma/minissl"
4
4
  require "integration/support/application"
5
5
 
6
6
  class IntegrationServer
7
-
8
7
  def self.run(options = {})
9
8
  server = new(options)
10
9
  server.run
@@ -76,7 +75,7 @@ class IntegrationServer
76
75
 
77
76
  context.key = IntegrationServer.ssl_key_file
78
77
  context.cert = IntegrationServer.ssl_cert_file
79
- context.verify_mode = Puma::MiniSSL::VERIFY_PEER
78
+ context.verify_mode = Puma::MiniSSL::VERIFY_NONE
80
79
 
81
80
  context
82
81
  end
data/spec/spec_helper.rb CHANGED
@@ -3,9 +3,7 @@ Bundler.setup(:default, :development)
3
3
 
4
4
  unless RUBY_PLATFORM =~ /java/
5
5
  require 'simplecov'
6
- require 'coveralls'
7
6
 
8
- SimpleCov.formatter = Coveralls::SimpleCov::Formatter
9
7
  SimpleCov.start do
10
8
  add_filter 'spec'
11
9
  end
metadata CHANGED
@@ -1,15 +1,15 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: httpi
3
3
  version: !ruby/object:Gem::Version
4
- version: 2.4.5
4
+ version: 2.5.0
5
5
  platform: ruby
6
6
  authors:
7
7
  - Daniel Harrington
8
8
  - Martin Tepper
9
- autorequire:
9
+ autorequire:
10
10
  bindir: bin
11
11
  cert_chain: []
12
- date: 2020-07-08 00:00:00.000000000 Z
12
+ date: 2021-10-05 00:00:00.000000000 Z
13
13
  dependencies:
14
14
  - !ruby/object:Gem::Dependency
15
15
  name: rack
@@ -59,28 +59,28 @@ dependencies:
59
59
  requirements:
60
60
  - - "~>"
61
61
  - !ruby/object:Gem::Version
62
- version: '10.0'
62
+ version: '13.0'
63
63
  type: :development
64
64
  prerelease: false
65
65
  version_requirements: !ruby/object:Gem::Requirement
66
66
  requirements:
67
67
  - - "~>"
68
68
  - !ruby/object:Gem::Version
69
- version: '10.0'
69
+ version: '13.0'
70
70
  - !ruby/object:Gem::Dependency
71
71
  name: rspec
72
72
  requirement: !ruby/object:Gem::Requirement
73
73
  requirements:
74
74
  - - "~>"
75
75
  - !ruby/object:Gem::Version
76
- version: '2.14'
76
+ version: '3.5'
77
77
  type: :development
78
78
  prerelease: false
79
79
  version_requirements: !ruby/object:Gem::Requirement
80
80
  requirements:
81
81
  - - "~>"
82
82
  - !ruby/object:Gem::Version
83
- version: '2.14'
83
+ version: '3.5'
84
84
  - !ruby/object:Gem::Dependency
85
85
  name: mocha
86
86
  requirement: !ruby/object:Gem::Requirement
@@ -101,14 +101,14 @@ dependencies:
101
101
  requirements:
102
102
  - - "~>"
103
103
  - !ruby/object:Gem::Version
104
- version: 2.3.2
104
+ version: '5.0'
105
105
  type: :development
106
106
  prerelease: false
107
107
  version_requirements: !ruby/object:Gem::Requirement
108
108
  requirements:
109
109
  - - "~>"
110
110
  - !ruby/object:Gem::Version
111
- version: 2.3.2
111
+ version: '5.0'
112
112
  - !ruby/object:Gem::Dependency
113
113
  name: webmock
114
114
  requirement: !ruby/object:Gem::Requirement
@@ -129,9 +129,9 @@ executables: []
129
129
  extensions: []
130
130
  extra_rdoc_files: []
131
131
  files:
132
+ - ".github/workflows/development.yml"
132
133
  - ".gitignore"
133
134
  - ".rspec"
134
- - ".travis.yml"
135
135
  - CHANGELOG.md
136
136
  - Gemfile
137
137
  - LICENSE
@@ -204,7 +204,7 @@ homepage: http://github.com/savonrb/httpi
204
204
  licenses:
205
205
  - MIT
206
206
  metadata: {}
207
- post_install_message:
207
+ post_install_message:
208
208
  rdoc_options: []
209
209
  require_paths:
210
210
  - lib
@@ -212,15 +212,15 @@ required_ruby_version: !ruby/object:Gem::Requirement
212
212
  requirements:
213
213
  - - ">="
214
214
  - !ruby/object:Gem::Version
215
- version: 1.9.2
215
+ version: '2.3'
216
216
  required_rubygems_version: !ruby/object:Gem::Requirement
217
217
  requirements:
218
218
  - - ">="
219
219
  - !ruby/object:Gem::Version
220
220
  version: '0'
221
221
  requirements: []
222
- rubygems_version: 3.0.3
223
- signing_key:
222
+ rubygems_version: 3.2.7
223
+ signing_key:
224
224
  specification_version: 4
225
225
  summary: Common interface for Ruby's HTTP libraries
226
226
  test_files: []
data/.travis.yml DELETED
@@ -1,6 +0,0 @@
1
- language: "ruby"
2
- script: "bundle exec rake ci"
3
- rvm:
4
- - 2.5.8
5
- - 2.6.6
6
- - 2.7.1