httpi 2.4.4 → 3.0.1

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: a39851ef3ab42a8c7ff8ddda62256da8f5f42b34fe0df16910686e4c25bf4565
4
- data.tar.gz: 627e8c2ae552288e8066f3305d9cf245dcb3c51d7421ab5dee9e731cb85e6f68
3
+ metadata.gz: c3e533863eed443ec1b23c42cf9959c3312c8ddff5a1b45102028263325ad473
4
+ data.tar.gz: 5ea0350ab1711603f712d0ae02ea6e14f3f89b225866585b5aff8833c855d60c
5
5
  SHA512:
6
- metadata.gz: f811738a0681dab582710c91b25c0210924bda41332413d50761ddb466121e7551a81f2bc9dcc3caba8bbe6bd5dbb9ec0dffa761e1e20aca4f28e9ffa02fa1f6
7
- data.tar.gz: 7a5f15293b034a71187dd5fbae304b763eca335dd20f05e1007f56c3770995c618446d4867d8b6dc8fa5e2f7b722abd490d2e71ca9a955e2470498f3fba76945
6
+ metadata.gz: 3d53e35db56687d59d42e7b7e2b609c00ec3f5d241a77189bcbd780c87d6596466a0e709d300ed66956e67634f228c94dff675bd60ec13b6c5a4d1422f5253d1
7
+ data.tar.gz: 29fa0caf340530e89c435c1730387d255301ad6a06395b8860c1642c272150c91ce0f5c7c128a5500aecf0ba5484fbeaed384600f60ce48a530dd51b76e8b690
@@ -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,3 +1,23 @@
1
+ ### 3.0.1 (2021-12-17)
2
+
3
+ * Fix: [#230](https://github.com/savonrb/httpi/pull/230) Make rack a runtime dependency.
4
+
5
+ ### 3.0.0 (2021-10-19)
6
+
7
+ * Improvement: [#225](https://github.com/savonrb/httpi/pull/225) Make rack and socksify dependencies optional.
8
+
9
+ ### 2.5.0 (2021-10-05)
10
+
11
+ * Feature: [#214](https://github.com/savonrb/httpi/pull/214) Add SSL ciphers configuration
12
+ * Improvement: [#227](https://github.com/savonrb/httpi/pull/227) Use GitHub Actions as CI. Require at least Ruby v2.3.
13
+
14
+ ### 2.4.5
15
+
16
+ * Improvement: [#209](https://github.com/savonrb/httpi/pull/209) Drop Travis CI support for Ruby < 2.3.0 and jruby.
17
+ * Feature: [#208](https://github.com/savonrb/httpi/pull/208) Add SSL min/max_version configuration for supporting adapters
18
+ * Improvement: [#206](https://github.com/savonrb/httpi/pull/206) Support for net-http-persistent v3
19
+ * Improvement: [#204](https://github.com/savonrb/httpi/pull/204) Avoid excon warning
20
+
1
21
  ### 2.4.4
2
22
 
3
23
  * Improvement: [#197](https://github.com/savonrb/httpi/pull/197) Add support for new write timeout option to all adapters
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
@@ -2,33 +2,22 @@
2
2
 
3
3
  A common interface for Ruby's HTTP libraries.
4
4
 
5
- [Documentation](https://www.rubydoc.info/gems/httpi) |
6
- [Mailing list](https://groups.google.com/forum/#!forum/httpirb)
7
-
8
- [![Build Status](https://secure.travis-ci.org/savonrb/httpi.png?branch=master)](http://travis-ci.org/savonrb/httpi)
9
- [![Gem Version](https://badge.fury.io/rb/httpi.png)](http://badge.fury.io/rb/httpi)
10
- [![Code Climate](https://codeclimate.com/github/savonrb/httpi.png)](https://codeclimate.com/github/savonrb/httpi)
11
- [![Coverage Status](https://coveralls.io/repos/savonrb/httpi/badge.png?branch=master)](https://coveralls.io/r/savonrb/httpi)
5
+ [Documentation](https://www.rubydoc.info/gems/httpi)
12
6
 
7
+ [![Development](https://github.com/savonrb/httpi/actions/workflows/development.yml/badge.svg)](https://github.com/savonrb/httpi/actions/workflows/development.yml)
13
8
 
14
9
  ## Installation
15
10
 
16
11
  HTTPI is available through [Rubygems](https://rubygems.org/gems/httpi) and can be installed via:
17
12
 
18
- ```
19
- $ gem install httpi
20
- ```
13
+ $ gem install httpi
21
14
 
22
15
  or add it to your Gemfile like this:
23
16
 
24
- ```
25
- gem 'httpi', '~> 2.1.0'
26
- ```
27
-
17
+ gem 'httpi', '~> 3.0.0'
28
18
 
29
19
  ## Usage example
30
20
 
31
-
32
21
  ``` ruby
33
22
  require "httpi"
34
23
 
@@ -49,6 +38,16 @@ HTTPI.adapter = :httpclient
49
38
  HTTPI.request(:custom, request)
50
39
  ```
51
40
 
41
+ ### SOCKS Proxy Support
42
+
43
+ To use the the SOCKS proxy support, please add the `socksify` gem to your gemfile, and add the following code:
44
+
45
+ ``` ruby
46
+ require 'socksify'
47
+ require 'socksify/http'
48
+ ```
49
+
50
+ to your project.
52
51
 
53
52
  ## Documentation
54
53
 
data/UPDATING.md ADDED
@@ -0,0 +1,7 @@
1
+ # Update guide
2
+
3
+ ## From 2.x to 3.x
4
+
5
+ BREAKING CHANGE: the [#255](https://github.com/savonrb/httpi/pull/225) made the gem socksify and rack gems optional dependencies.
6
+
7
+ In order to restore the old behavior, see the README section "SOCKS Proxy Support" and "Rack Mock Adapter".
data/httpi.gemspec CHANGED
@@ -11,19 +11,18 @@ 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'
15
14
 
16
- s.rubyforge_project = s.name
15
+ s.required_ruby_version = '>= 2.3'
16
+
17
17
  s.license = 'MIT'
18
18
 
19
19
  s.add_dependency 'rack'
20
- s.add_dependency 'socksify'
21
20
 
22
21
  s.add_development_dependency 'rubyntlm', '~> 0.3.2'
23
- s.add_development_dependency 'rake', '~> 10.0'
24
- s.add_development_dependency 'rspec', '~> 2.14'
22
+ s.add_development_dependency 'rake', '~> 13.0'
23
+ s.add_development_dependency 'rspec', '~> 3.5'
25
24
  s.add_development_dependency 'mocha', '~> 0.13'
26
- s.add_development_dependency 'puma', '~> 2.3.2'
25
+ s.add_development_dependency 'puma', '~> 5.0'
27
26
  s.add_development_dependency 'webmock'
28
27
 
29
28
  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
@@ -128,6 +129,9 @@ module HTTPI
128
129
  when :SSLv23 then 2
129
130
  when :SSLv3 then 3
130
131
  end
132
+ if ssl.min_version || ssl.max_version
133
+ raise NotSupportedError, 'Curb adapter does not support #min_version or #max_version. Please, use #ssl_version instead.'
134
+ end
131
135
  end
132
136
 
133
137
  def respond_with(client)
@@ -41,6 +41,7 @@ module HTTPI
41
41
 
42
42
  opts = {
43
43
  :host => url.host,
44
+ :hostname => url.hostname,
44
45
  :path => url.path,
45
46
  :port => url.port,
46
47
  :query => url.query,
@@ -72,7 +73,10 @@ module HTTPI
72
73
  opts[:ssl_verify_peer] = false
73
74
  end
74
75
 
76
+ opts[:ciphers] = ssl.ciphers if ssl.ciphers
75
77
  opts[:ssl_version] = ssl.ssl_version if ssl.ssl_version
78
+ opts[:ssl_min_version] = ssl.min_version if ssl.min_version
79
+ opts[:ssl_max_version] = ssl.max_version if ssl.max_version
76
80
 
77
81
  opts
78
82
  end
@@ -58,7 +58,10 @@ module HTTPI
58
58
  context.cert = @request.auth.ssl.cert
59
59
  context.key = @request.auth.ssl.cert_key
60
60
  context.ssl_version = @request.auth.ssl.ssl_version if @request.auth.ssl.ssl_version != nil
61
+ context.min_version = @request.auth.ssl.min_version if @request.auth.ssl.min_version != nil
62
+ context.max_version = @request.auth.ssl.max_version if @request.auth.ssl.max_version != nil
61
63
  context.verify_mode = @request.auth.ssl.openssl_verify_mode
64
+ context.ciphers = @request.auth.ssl.ciphers if @request.auth.ssl.ciphers
62
65
 
63
66
  client = ::HTTP::Client.new(:ssl_context => context)
64
67
  else
@@ -73,11 +73,15 @@ 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
79
80
 
80
81
  @client.ssl_config.ssl_version = ssl.ssl_version.to_s if ssl.ssl_version
82
+ if ssl.min_version || ssl.max_version
83
+ raise NotSupportedError, 'Httpclient adapter does not support #min_version or #max_version. Please, use #ssl_version instead'
84
+ end
81
85
  end
82
86
 
83
87
  def respond_with(response)
@@ -4,8 +4,6 @@ require "httpi/adapter/base"
4
4
  require "httpi/response"
5
5
  require 'kconv'
6
6
  require 'socket'
7
- require "socksify"
8
- require 'socksify/http'
9
7
 
10
8
  module HTTPI
11
9
  module Adapter
@@ -177,11 +175,14 @@ module HTTPI
177
175
  # Send client-side certificate regardless of state of SSL verify mode
178
176
  @client.key = ssl.cert_key
179
177
  @client.cert = ssl.cert
178
+ @client.ciphers = ssl.ciphers if ssl.ciphers
180
179
 
181
180
  @client.verify_mode = ssl.openssl_verify_mode
182
181
  end
183
182
 
184
183
  @client.ssl_version = ssl.ssl_version if ssl.ssl_version
184
+ @client.min_version = ssl.min_version if ssl.min_version
185
+ @client.max_version = ssl.max_version if ssl.max_version
185
186
  end
186
187
 
187
188
  def ssl_cert_store(ssl)
@@ -12,7 +12,11 @@ module HTTPI
12
12
  private
13
13
 
14
14
  def create_client
15
- Net::HTTP::Persistent.new thread_key
15
+ if Gem::Version.new(Net::HTTP::Persistent::VERSION) >= Gem::Version.new('3.0.0')
16
+ Net::HTTP::Persistent.new name: thread_key
17
+ else
18
+ Net::HTTP::Persistent.new thread_key
19
+ end
16
20
  end
17
21
 
18
22
  def perform(http, http_request, &on_body)
@@ -38,7 +42,6 @@ module HTTPI
38
42
  def thread_key
39
43
  @request.url.host.split(/\W/).reject{|p|p == ""}.join('-')
40
44
  end
41
-
42
45
  end
43
46
  end
44
47
  end
@@ -20,9 +20,12 @@ module HTTPI
20
20
  ssl_context::METHODS.reject { |method| method.match(/server|client/) }
21
21
  end.sort.reverse
22
22
 
23
+ # Returns OpenSSL::SSL::*_VERSION values for min_version and max_version
24
+ MIN_MAX_VERSIONS = OpenSSL::SSL.constants.select{|constant| constant =~/_VERSION$/}.map{|version| version.to_s.gsub(/_VERSION$/,'').to_sym}.reverse
25
+
23
26
  # Returns whether SSL configuration is present.
24
27
  def present?
25
- (verify_mode == :none) || (cert && cert_key) || ca_cert_file
28
+ (verify_mode == :none) || (cert && cert_key) || ca_cert_file || ciphers
26
29
  rescue TypeError, Errno::ENOENT
27
30
  false
28
31
  end
@@ -45,6 +48,24 @@ module HTTPI
45
48
  # Certificate store holds trusted CA certificates used to verify peer certificates.
46
49
  attr_accessor :cert_store
47
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
+
48
69
  # Returns the cert type to validate SSL certificates PEM|DER.
49
70
  def cert_type
50
71
  @cert_type ||= :pem
@@ -90,6 +111,36 @@ module HTTPI
90
111
  @ssl_version = version
91
112
  end
92
113
 
114
+ # Returns the SSL min_version number. Defaults to <tt>nil</tt> (auto-negotiate).
115
+ def min_version
116
+ @min_version ||= nil
117
+ end
118
+
119
+ # Sets the SSL min_version number. Expects one of <tt>HTTPI::Auth::SSL::MIN_MAX_VERSIONS</tt>.
120
+ def min_version=(version)
121
+ unless MIN_MAX_VERSIONS.include? version
122
+ raise ArgumentError, "Invalid SSL min_version #{version.inspect}\n" +
123
+ "Please specify one of #{MIN_MAX_VERSIONS.inspect}"
124
+ end
125
+
126
+ @min_version = version
127
+ end
128
+
129
+ # Returns the SSL min_version number. Defaults to <tt>nil</tt> (auto-negotiate).
130
+ def max_version
131
+ @max_version ||= nil
132
+ end
133
+
134
+ # Sets the SSL min_version number. Expects one of <tt>HTTPI::Auth::SSL::MIN_MAX_VERSIONS</tt>.
135
+ def max_version=(version)
136
+ unless MIN_MAX_VERSIONS.include? version
137
+ raise ArgumentError, "Invalid SSL max_version #{version.inspect}\n" +
138
+ "Please specify one of #{MIN_MAX_VERSIONS.inspect}"
139
+ end
140
+
141
+ @max_version = version
142
+ end
143
+
93
144
  # Returns an <tt>OpenSSL::X509::Certificate</tt> for the +cert_file+.
94
145
  def cert
95
146
  @cert ||= (OpenSSL::X509::Certificate.new File.read(cert_file) if cert_file)
data/lib/httpi/version.rb CHANGED
@@ -1,3 +1,3 @@
1
1
  module HTTPI
2
- VERSION = '2.4.4'
2
+ VERSION = '3.0.1'
3
3
  end
@@ -1,16 +1,20 @@
1
1
  -----BEGIN CERTIFICATE-----
2
- MIICbTCCAdYCCQDC4v8d04615DANBgkqhkiG9w0BAQUFADB7MQswCQYDVQQGEwJE
3
- RTEQMA4GA1UECBMHSGFtYnVyZzEQMA4GA1UEBxMHSGFtYnVyZzEOMAwGA1UEChMF
4
- aHR0cGkxFDASBgNVBAMTC2V4YW1wbGUuY29tMSIwIAYJKoZIhvcNAQkBFhNleGFt
5
- cGxlQGV4YW1wbGUuY29tMB4XDTEwMTAxNTE4NTg0N1oXDTExMTAxNTE4NTg0N1ow
6
- ezELMAkGA1UEBhMCREUxEDAOBgNVBAgTB0hhbWJ1cmcxEDAOBgNVBAcTB0hhbWJ1
7
- cmcxDjAMBgNVBAoTBWh0dHBpMRQwEgYDVQQDEwtleGFtcGxlLmNvbTEiMCAGCSqG
8
- SIb3DQEJARYTZXhhbXBsZUB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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)
@@ -278,6 +285,16 @@ unless RUBY_PLATFORM =~ /java/
278
285
  adapter.request(:get)
279
286
  end
280
287
  end
288
+ it 'raises error when min_version not nil' do
289
+ request.auth.ssl.min_version = :TLS1_2
290
+ expect{ adapter.request(:get) }.
291
+ to raise_error(HTTPI::NotSupportedError, 'Curb adapter does not support #min_version or #max_version. Please, use #ssl_version instead.')
292
+ end
293
+ it 'raises error when max_version not nil' do
294
+ request.auth.ssl.max_version = :TLS1_2
295
+ expect{ adapter.request(:get) }.
296
+ to raise_error(HTTPI::NotSupportedError, 'Curb adapter does not support #min_version or #max_version. Please, use #ssl_version instead.')
297
+ end
281
298
  end
282
299
 
283
300
  context "(for SSL client auth)" do
@@ -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
@@ -23,6 +23,12 @@ begin
23
23
  )
24
24
  end
25
25
  end
26
+ describe "host, hostname" do
27
+ it "both are set" do
28
+ Excon.expects(:display_warning).never
29
+ expect(adapter.client.data).to include(host: 'example.com', hostname: 'example.com')
30
+ end
31
+ end
26
32
  end
27
33
  end
28
34
  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
@@ -178,6 +185,17 @@ describe HTTPI::Adapter::HTTPClient do
178
185
 
179
186
  adapter.request(:get)
180
187
  end
188
+
189
+ it 'raises error when min_version not nil' do
190
+ request.auth.ssl.min_version = :TLS1_2
191
+ expect{ adapter.request(:get) }.
192
+ to raise_error(HTTPI::NotSupportedError, 'Httpclient adapter does not support #min_version or #max_version. Please, use #ssl_version instead')
193
+ end
194
+ it 'raises error when max_version not nil' do
195
+ request.auth.ssl.max_version = :TLS1_2
196
+ expect{ adapter.request(:get) }.
197
+ to raise_error(HTTPI::NotSupportedError, 'Httpclient adapter does not support #min_version or #max_version. Please, use #ssl_version instead')
198
+ end
181
199
  end
182
200
 
183
201
  context "(for SSL client auth with a verify mode of :none with no certs provided)" do
@@ -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"
@@ -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
 
@@ -129,6 +129,16 @@ describe HTTPI::Adapter::HTTPClient do
129
129
  expect(response.body).to eq("get")
130
130
  end
131
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
+
132
142
  it "works with client cert and key provided as file path" do
133
143
  request = HTTPI::Request.new(@server.url)
134
144
  request.auth.ssl.ca_cert_file = IntegrationServer.ssl_ca_file
@@ -149,6 +159,15 @@ describe HTTPI::Adapter::HTTPClient do
149
159
  response = HTTPI.get(request, adapter)
150
160
  expect(response.body).to eq("get")
151
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
152
171
  end
153
172
  end
154
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/weySg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jF+WnGfhJHv7VOcLlmFD1fa/IIM9xuBRgikiBWHtFwLoXknsY8
17
+ y2VqNrPEkjCp+qLpXLC8l3dzpNU33Z42h/tUfoTmgSgDUQXGggjzbcS8cf+1D55z
18
+ KuPazKAndyiuhIENk1gE+5RKdNyjYP2sI4+L5jexAoGBANxx2rw9GywHj9n/P006
19
+ pnO2Ol49nGsYiWp5E3bwZtIl+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-----
@@ -131,6 +131,25 @@ describe HTTPI::Adapter::HTTP do
131
131
  response = HTTPI.get(request, adapter)
132
132
  expect(response.body).to eq("get")
133
133
  end
134
+
135
+ it "works with min_version/max_version" do
136
+ request = HTTPI::Request.new(@server.url)
137
+ request.auth.ssl.ca_cert_file = IntegrationServer.ssl_ca_file
138
+ request.auth.ssl.min_version = :TLS1_2
139
+ request.auth.ssl.max_version = :TLS1_2
140
+
141
+ response = HTTPI.get(request, adapter)
142
+ expect(response.body).to eq("get")
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
134
153
  end
135
154
  end
136
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
 
@@ -93,11 +93,19 @@ describe HTTPI::Adapter::NetHTTP do
93
93
  end
94
94
  }
95
95
  let(:request_body) { nil }
96
- let(:response) { HTTPI.request(http_method, request, adapter) }
96
+
97
+ subject(:response) { HTTPI.request(http_method, request, adapter) }
97
98
 
98
99
  shared_examples_for "any supported custom method" do
99
- specify { response.body.should eq http_method.to_s }
100
- specify { response.headers["Content-Type"].should eq("text/plain") }
100
+ describe '#body' do
101
+ subject(:body) {response.body}
102
+ it { is_expected.to be == http_method.to_s }
103
+ end
104
+
105
+ describe '#headers' do
106
+ subject(:headers) {response.headers}
107
+ it { is_expected.to include('content-type' => "text/plain")}
108
+ end
101
109
  end
102
110
 
103
111
  context "PATCH method" do
@@ -217,6 +225,25 @@ describe HTTPI::Adapter::NetHTTP do
217
225
  response = HTTPI.get(request, adapter)
218
226
  expect(response.body).to eq("get")
219
227
  end
228
+
229
+ it "works with min_version/max_version" do
230
+ request = HTTPI::Request.new(@server.url)
231
+ request.auth.ssl.ca_cert_file = IntegrationServer.ssl_ca_file
232
+ request.auth.ssl.min_version = :TLS1_2
233
+ request.auth.ssl.max_version = :TLS1_2
234
+
235
+ response = HTTPI.get(request, adapter)
236
+ expect(response.body).to eq("get")
237
+ end
238
+
239
+ it "works with ciphers" do
240
+ request = HTTPI::Request.new(@server.url)
241
+ request.auth.ssl.ca_cert_file = IntegrationServer.ssl_ca_file
242
+ request.auth.ssl.ciphers = OpenSSL::SSL::SSLContext.new.ciphers
243
+
244
+ response = HTTPI.get(request, adapter)
245
+ expect(response.body).to eq("get")
246
+ end
220
247
  end
221
248
  end
222
249
 
@@ -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.4
4
+ version: 3.0.1
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: 2018-09-05 00:00:00.000000000 Z
12
+ date: 2021-12-17 00:00:00.000000000 Z
13
13
  dependencies:
14
14
  - !ruby/object:Gem::Dependency
15
15
  name: rack
@@ -25,20 +25,6 @@ dependencies:
25
25
  - - ">="
26
26
  - !ruby/object:Gem::Version
27
27
  version: '0'
28
- - !ruby/object:Gem::Dependency
29
- name: socksify
30
- requirement: !ruby/object:Gem::Requirement
31
- requirements:
32
- - - ">="
33
- - !ruby/object:Gem::Version
34
- version: '0'
35
- type: :runtime
36
- prerelease: false
37
- version_requirements: !ruby/object:Gem::Requirement
38
- requirements:
39
- - - ">="
40
- - !ruby/object:Gem::Version
41
- version: '0'
42
28
  - !ruby/object:Gem::Dependency
43
29
  name: rubyntlm
44
30
  requirement: !ruby/object:Gem::Requirement
@@ -59,28 +45,28 @@ dependencies:
59
45
  requirements:
60
46
  - - "~>"
61
47
  - !ruby/object:Gem::Version
62
- version: '10.0'
48
+ version: '13.0'
63
49
  type: :development
64
50
  prerelease: false
65
51
  version_requirements: !ruby/object:Gem::Requirement
66
52
  requirements:
67
53
  - - "~>"
68
54
  - !ruby/object:Gem::Version
69
- version: '10.0'
55
+ version: '13.0'
70
56
  - !ruby/object:Gem::Dependency
71
57
  name: rspec
72
58
  requirement: !ruby/object:Gem::Requirement
73
59
  requirements:
74
60
  - - "~>"
75
61
  - !ruby/object:Gem::Version
76
- version: '2.14'
62
+ version: '3.5'
77
63
  type: :development
78
64
  prerelease: false
79
65
  version_requirements: !ruby/object:Gem::Requirement
80
66
  requirements:
81
67
  - - "~>"
82
68
  - !ruby/object:Gem::Version
83
- version: '2.14'
69
+ version: '3.5'
84
70
  - !ruby/object:Gem::Dependency
85
71
  name: mocha
86
72
  requirement: !ruby/object:Gem::Requirement
@@ -101,14 +87,14 @@ dependencies:
101
87
  requirements:
102
88
  - - "~>"
103
89
  - !ruby/object:Gem::Version
104
- version: 2.3.2
90
+ version: '5.0'
105
91
  type: :development
106
92
  prerelease: false
107
93
  version_requirements: !ruby/object:Gem::Requirement
108
94
  requirements:
109
95
  - - "~>"
110
96
  - !ruby/object:Gem::Version
111
- version: 2.3.2
97
+ version: '5.0'
112
98
  - !ruby/object:Gem::Dependency
113
99
  name: webmock
114
100
  requirement: !ruby/object:Gem::Requirement
@@ -129,14 +115,15 @@ executables: []
129
115
  extensions: []
130
116
  extra_rdoc_files: []
131
117
  files:
118
+ - ".github/workflows/development.yml"
132
119
  - ".gitignore"
133
120
  - ".rspec"
134
- - ".travis.yml"
135
121
  - CHANGELOG.md
136
122
  - Gemfile
137
123
  - LICENSE
138
124
  - README.md
139
125
  - Rakefile
126
+ - UPDATING.md
140
127
  - httpi.gemspec
141
128
  - lib/httpi.rb
142
129
  - lib/httpi/adapter.rb
@@ -204,7 +191,7 @@ homepage: http://github.com/savonrb/httpi
204
191
  licenses:
205
192
  - MIT
206
193
  metadata: {}
207
- post_install_message:
194
+ post_install_message:
208
195
  rdoc_options: []
209
196
  require_paths:
210
197
  - lib
@@ -212,16 +199,15 @@ required_ruby_version: !ruby/object:Gem::Requirement
212
199
  requirements:
213
200
  - - ">="
214
201
  - !ruby/object:Gem::Version
215
- version: 1.9.2
202
+ version: '2.3'
216
203
  required_rubygems_version: !ruby/object:Gem::Requirement
217
204
  requirements:
218
205
  - - ">="
219
206
  - !ruby/object:Gem::Version
220
207
  version: '0'
221
208
  requirements: []
222
- rubyforge_project: httpi
223
- rubygems_version: 2.7.6
224
- signing_key:
209
+ rubygems_version: 3.2.7
210
+ signing_key:
225
211
  specification_version: 4
226
212
  summary: Common interface for Ruby's HTTP libraries
227
213
  test_files: []
data/.travis.yml DELETED
@@ -1,15 +0,0 @@
1
- language: "ruby"
2
- script: "bundle exec rake ci"
3
- sudo: false
4
- rvm:
5
- - 2.0.0
6
- - 2.1.8
7
- - 2.2.4
8
- - 2.3.0
9
- - 2.5.0
10
- - jruby-9.1.9.0
11
- env:
12
- global:
13
- - JRUBY_OPTS="--2.0"
14
- before_install:
15
- - "travis_retry gem install bundler"