Skip to content

Commit

Permalink
Merge cb2711e into 7bc8ed8
Browse files Browse the repository at this point in the history
  • Loading branch information
webhoernchen committed Jan 11, 2018
2 parents 7bc8ed8 + cb2711e commit 69b7142
Show file tree
Hide file tree
Showing 4 changed files with 16 additions and 5 deletions.
6 changes: 5 additions & 1 deletion .travis.yml
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,11 @@ rvm:
- 2.1.8
- 2.2.4
- 2.3.0
- jruby
- 2.5.0
- jruby-9.1.9.0
env:
global:
- JRUBY_OPTS="--2.0"
before_install:
- "travis_retry gem update --system"
- "travis_retry gem install bundler"
10 changes: 9 additions & 1 deletion lib/httpi/auth/ssl.rb
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,15 @@ class SSL

VERIFY_MODES = [:none, :peer, :fail_if_no_peer_cert, :client_once]
CERT_TYPES = [:pem, :der]
SSL_VERSIONS = OpenSSL::SSL::SSLContext::METHODS.reject { |method| method.match(/server|client/) }.sort.reverse

# Fix for
# httpi/auth/ssl.rb:13: warning: constant OpenSSL::SSL::SSLContext::METHODS is deprecated
ssl_context = OpenSSL::SSL::SSLContext
SSL_VERSIONS = if ssl_context.const_defined? :METHODS_MAP
ssl_context.const_get(:METHODS_MAP).keys
else
ssl_context::METHODS.reject { |method| method.match(/server|client/) }
end.sort.reverse

# Returns whether SSL configuration is present.
def present?
Expand Down
3 changes: 1 addition & 2 deletions spec/httpi/adapter/curb_spec.rb
Original file line number Diff line number Diff line change
Expand Up @@ -257,8 +257,7 @@
end

it 'to 2 when ssl_version is specified as SSLv2/SSLv23' do
version = OpenSSL::SSL::SSLContext::METHODS.reject { |method| method.match(/server|client/) }
version = version.select { |method| method.to_s.match(/SSLv2|SSLv23/) }.first
version = HTTPI::Auth::SSL::SSL_VERSIONS.select { |method| method.to_s.match(/SSLv2|SSLv23/) }.first
request.auth.ssl.ssl_version = version
curb.expects(:ssl_version=).with(2)

Expand Down
2 changes: 1 addition & 1 deletion spec/httpi/auth/ssl_spec.rb
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@

describe HTTPI::Auth::SSL do
before(:all) do
@ssl_versions = OpenSSL::SSL::SSLContext::METHODS.reject { |method| method.match(/server|client/) }.sort.reverse
@ssl_versions = HTTPI::Auth::SSL::SSL_VERSIONS
end

describe "VERIFY_MODES" do
Expand Down

0 comments on commit 69b7142

Please sign in to comment.