Skip to content

Commit

Permalink
added global :ssl_version option. related #297.
Browse files Browse the repository at this point in the history
  • Loading branch information
rubiii committed Dec 19, 2012
1 parent cd94583 commit 08d8856
Show file tree
Hide file tree
Showing 4 changed files with 17 additions and 1 deletion.
2 changes: 1 addition & 1 deletion CHANGELOG.md
@@ -1,7 +1,7 @@
## 2.0.2 (UPCOMING)

* Fix: [#297](https://github.com/savonrb/savon/issues/297#issuecomment-11536517) added the global
`:ssl_verify_mode` option set the verify mode to use for SOAP requests.
`:ssl_verify_mode` and `:ssl_version` options which were missing.

## 2.0.1 (2012-12-19)

Expand Down
5 changes: 5 additions & 0 deletions lib/savon/options.rb
Expand Up @@ -180,6 +180,11 @@ def last_response(last_response)
@options[:last_response] = last_response
end

# Specifies the SSL version to use.
def ssl_version(version)
@options[:ssl_version] = version
end

# Whether and how to to verify the connection.
def ssl_verify_mode(verify_mode)
@options[:ssl_verify_mode] = verify_mode
Expand Down
2 changes: 2 additions & 0 deletions lib/savon/request.rb
Expand Up @@ -48,7 +48,9 @@ def create_http_client
http.headers["SOAPAction"] ||= %{"#{soap_action}"} if soap_action
http.headers["Content-Type"] = CONTENT_TYPE[@globals[:soap_version]] % @globals[:encoding]

http.auth.ssl.ssl_version = @globals[:ssl_version] if @globals.include? :ssl_version
http.auth.ssl.verify_mode = @globals[:ssl_verify_mode] if @globals.include? :ssl_verify_mode

http.auth.basic(*@globals[:basic_auth]) if @globals.include? :basic_auth
http.auth.digest(*@globals[:digest_auth]) if @globals.include? :digest_auth

Expand Down
9 changes: 9 additions & 0 deletions spec/savon/options_spec.rb
Expand Up @@ -255,6 +255,15 @@
end
end

context "global :ssl_version" do
it "sets the SSL version to use" do
HTTPI::Auth::SSL.any_instance.expects(:ssl_version=).with(:SSLv3)

client = new_client(:endpoint => @server.url, :ssl_version => :SSLv3)
client.call(:authenticate)
end
end

context "global :ssl_verify_mode" do
it "sets the verify mode to use" do
HTTPI::Auth::SSL.any_instance.expects(:verify_mode=).with(:none)
Expand Down

0 comments on commit 08d8856

Please sign in to comment.