Permalink
Browse files

Changed SSL version to SSLv23 since some people don't support TLS 1.2…

  • Loading branch information...
treeder committed Oct 27, 2014
1 parent 165170c commit ae72fa75555ae8a20b51402461fb3adeb6bb3f50
Showing with 8 additions and 8 deletions.
  1. +2 −2 lib/restclient/request.rb
  2. +6 −6 spec/unit/request_spec.rb
@@ -22,7 +22,7 @@ module RestClient
# * :verify_ssl enable ssl verification, possible values are constants from OpenSSL::SSL
# * :timeout and :open_timeout passing in -1 will disable the timeout by setting the corresponding net timeout values to nil
# * :ssl_client_cert, :ssl_client_key, :ssl_ca_file, :ssl_ca_path
# * :ssl_version specifies the SSL version for the underlying Net::HTTP connection (defaults to 'TLSv1_2')
# * :ssl_version specifies the SSL version for the underlying Net::HTTP connection (defaults to 'SSLv23')
class Request

attr_reader :method, :url, :headers, :cookies,
@@ -56,7 +56,7 @@ def initialize args
@ssl_client_key = args[:ssl_client_key] || nil
@ssl_ca_file = args[:ssl_ca_file] || nil
@ssl_ca_path = args[:ssl_ca_path] || nil
@ssl_version = args[:ssl_version] || 'TLSv1_2'
@ssl_version = args[:ssl_version] || 'SSLv23'
@tf = nil # If you are a raw request, this is your tempfile
@max_redirects = args[:max_redirects] || 10
@processed_headers = make_headers headers
@@ -202,15 +202,15 @@

it "transmits the request with Net::HTTP" do
@http.should_receive(:request).with('req', 'payload')
@net.should_receive(:ssl_version=).with('TLSv1_2')
@net.should_receive(:ssl_version=).with('SSLv23')
@request.should_receive(:process_result)
@request.transmit(@uri, 'req', 'payload')
end

describe "payload" do
it "sends nil payloads" do
@http.should_receive(:request).with('req', nil)
@net.should_receive(:ssl_version=).with('TLSv1_2')
@net.should_receive(:ssl_version=).with('SSLv23')
@request.should_receive(:process_result)
@request.stub(:response_log)
@request.transmit(@uri, 'req', nil)
@@ -240,7 +240,7 @@
describe "credentials" do
it "sets up the credentials prior to the request" do
@http.stub(:request)
@net.should_receive(:ssl_version=).with('TLSv1_2')
@net.should_receive(:ssl_version=).with('SSLv23')

@request.stub(:process_result)
@request.stub(:response_log)
@@ -270,7 +270,7 @@

it "catches EOFError and shows the more informative ServerBrokeConnection" do
@http.stub(:request).and_raise(EOFError)
@net.should_receive(:ssl_version=).with('TLSv1_2')
@net.should_receive(:ssl_version=).with('SSLv23')
lambda { @request.transmit(@uri, 'req', nil) }.should raise_error(RestClient::ServerBrokeConnection)
end

@@ -405,7 +405,7 @@
it "uses SSL when the URI refers to a https address" do
@uri.stub(:is_a?).with(URI::HTTPS).and_return(true)
@net.should_receive(:use_ssl=).with(true)
@net.should_receive(:ssl_version=).with('TLSv1_2')
@net.should_receive(:ssl_version=).with('SSLv23')
@http.stub(:request)
@request.stub(:process_result)
@request.stub(:response_log)
@@ -418,7 +418,7 @@

it "should set net.verify_mode to OpenSSL::SSL::VERIFY_NONE if verify_ssl is false" do
@net.should_receive(:verify_mode=).with(OpenSSL::SSL::VERIFY_NONE)
@net.should_receive(:ssl_version=).with('TLSv1_2')
@net.should_receive(:ssl_version=).with('SSLv23')
@http.stub(:request)
@request.stub(:process_result)
@request.stub(:response_log)

0 comments on commit ae72fa7

Please sign in to comment.