Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Change default SSL version to nil to use TLS version negotiation. #186

Merged
merged 1 commit into from
May 21, 2014
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
8 changes: 5 additions & 3 deletions lib/httpclient/ssl_config.rb
Original file line number Diff line number Diff line change
Expand Up @@ -34,7 +34,9 @@ class HTTPClient
class SSLConfig
include OpenSSL if SSLEnabled

# String name of OpenSSL's SSL version method name: SSLv2, SSLv23 or SSLv3
# String name of OpenSSL's SSL version method name: TLSv1_2, TLSv1_1, TLSv1,
# SSLv2, SSLv23, SSLv3 or nil to allow version negotiation (default).
# See {OpenSSL::SSL::SSLContext::METHODS}.
attr_reader :ssl_version
# OpenSSL::X509::Certificate:: certificate for SSL client authenticateion.
# nil by default. (no client authenticateion)
Expand Down Expand Up @@ -83,7 +85,7 @@ def initialize(client)
@verify_callback = nil
@dest = nil
@timeout = nil
@ssl_version = "SSLv3"
@ssl_version = nil
@options = defined?(SSL::OP_ALL) ? SSL::OP_ALL | SSL::OP_NO_SSLv2 : nil
# OpenSSL 0.9.8 default: "ALL:!ADH:!LOW:!EXP:!MD5:+SSLv2:@STRENGTH"
@ciphers = "ALL:!aNULL:!eNULL:!SSLv2" # OpenSSL >1.0.0 default
Expand Down Expand Up @@ -283,7 +285,7 @@ def set_context(ctx) # :nodoc:
ctx.timeout = @timeout
ctx.options = @options
ctx.ciphers = @ciphers
ctx.ssl_version = @ssl_version
ctx.ssl_version = @ssl_version if @ssl_version
end

# post connection check proc for ruby < 1.8.5.
Expand Down