mirror of
https://github.com/jnunemaker/httparty
synced 2023-03-27 23:23:07 -04:00
Merge branch 'openssl-ciphers2' of https://github.com/where/httparty into where-openssl-ciphers2
Conflicts: spec/httparty/connection_adapter_spec.rb
This commit is contained in:
commit
a936eaab93
4 changed files with 35 additions and 1 deletions
|
@ -299,7 +299,7 @@ module HTTParty
|
|||
default_options[:query_string_normalizer] = normalizer
|
||||
end
|
||||
|
||||
# Allows setting of SSL version to use. This only works in Ruby 1.9.
|
||||
# Allows setting of SSL version to use. This only works in Ruby 1.9+.
|
||||
# You can get a list of valid versions from OpenSSL::SSL::SSLContext::METHODS.
|
||||
#
|
||||
# class Foo
|
||||
|
@ -310,6 +310,19 @@ module HTTParty
|
|||
default_options[:ssl_version] = version
|
||||
end
|
||||
|
||||
# Allows setting of SSL ciphers to use. This only works in Ruby 1.9+.
|
||||
# You can get a list of valid specific ciphers from OpenSSL::Cipher.ciphers.
|
||||
# You also can specify a cipher suite here, listed here at openssl.org:
|
||||
# http://www.openssl.org/docs/apps/ciphers.html#CIPHER_SUITE_NAMES
|
||||
#
|
||||
# class Foo
|
||||
# include HTTParty
|
||||
# ciphers "RC4-SHA"
|
||||
# end
|
||||
def ciphers(cipher_names)
|
||||
default_options[:ciphers] = cipher_names
|
||||
end
|
||||
|
||||
# Allows setting an OpenSSL certificate authority file
|
||||
#
|
||||
# class Foo
|
||||
|
|
|
@ -81,6 +81,10 @@ module HTTParty
|
|||
http.set_debug_output(options[:debug_output])
|
||||
end
|
||||
|
||||
if options[:ciphers]
|
||||
http.ciphers = options[:ciphers]
|
||||
end
|
||||
|
||||
return http
|
||||
end
|
||||
|
||||
|
|
|
@ -78,6 +78,7 @@ describe HTTParty::ConnectionAdapter do
|
|||
it { should use_ssl }
|
||||
end
|
||||
|
||||
|
||||
context "when ssl version is set" do
|
||||
let(:options) { {:ssl_version => :TLSv1} }
|
||||
|
||||
|
@ -95,6 +96,14 @@ describe HTTParty::ConnectionAdapter do
|
|||
end
|
||||
end
|
||||
|
||||
context "specifying ciphers" do
|
||||
let(:options) { {:ciphers => 'RC4-SHA' } }
|
||||
|
||||
it "should set the ciphers on the connection" do
|
||||
subject.ciphers.should == 'RC4-SHA'
|
||||
end
|
||||
end if RUBY_VERSION > '1.9'
|
||||
|
||||
context "when timeout is not set" do
|
||||
it "doesn't set the timeout" do
|
||||
http = mock("http", :null_object => true)
|
||||
|
|
|
@ -45,6 +45,14 @@ describe HTTParty do
|
|||
end
|
||||
end
|
||||
|
||||
describe 'ciphers' do
|
||||
it 'should set the ciphers content' do
|
||||
@klass.default_options[:ciphers].should be_nil
|
||||
@klass.ciphers 'RC4-SHA'
|
||||
@klass.default_options[:ciphers].should == 'RC4-SHA'
|
||||
end
|
||||
end
|
||||
|
||||
describe 'http_proxy' do
|
||||
it 'should set the address' do
|
||||
@klass.http_proxy 'proxy.foo.com', 80
|
||||
|
|
Loading…
Reference in a new issue