Permalink
Browse files

Merge branch 'master' of https://github.com/tjgfernandes/handsoap

  • Loading branch information...
2 parents 48d2ef5 + 445214a commit 70efc93b6d5b48890965d9cfcb65d48181590139 @twarberg committed Apr 20, 2012
Showing with 7 additions and 1 deletion.
  1. +1 −0 lib/handsoap/http/drivers/http_client_driver.rb
  2. +5 −1 lib/handsoap/http/request.rb
  3. +1 −0 lib/handsoap/service.rb
@@ -18,6 +18,7 @@ def send_http_request(request)
end
http_client.ssl_config.set_trust_ca(request.trust_ca_file) if request.trust_ca_file
http_client.ssl_config.set_client_cert_file(request.client_cert_file,request.client_cert_key_file) if request.client_cert_file and request.client_cert_key_file
+ http_client.ssl_config.verify_mode = request.ssl_verify_mode if request.ssl_verify_mode
# pack headers
headers = request.headers.inject([]) do |arr, (k,v)|
arr + v.map {|x| [k,x] }
@@ -5,7 +5,7 @@ module Http
# Represents a HTTP Request.
class Request
- attr_reader :url, :http_method, :headers, :body, :username, :password, :trust_ca_file, :client_cert_file, :client_cert_key_file
+ attr_reader :url, :http_method, :headers, :body, :username, :password, :trust_ca_file, :client_cert_file, :client_cert_key_file,:ssl_verify_mode
attr_writer :body, :http_method
def initialize(url, http_method = :get)
@url = url
@@ -17,6 +17,7 @@ def initialize(url, http_method = :get)
@trust_ca_file = nil
@client_cert_file = nil
@client_cert_key_file = nil
+ @ssl_verify_mode = nil
end
def set_trust_ca_file(ca_file)
@trust_ca_file = ca_file
@@ -25,6 +26,9 @@ def set_client_cert_files(client_cert_file,client_cert_key_file)
@client_cert_file = client_cert_file
@client_cert_key_file = client_cert_key_file
end
+ def set_ssl_verify_mode(mode)
+ @ssl_verify_mode = mode
+ end
def set_auth(username, password)
@username = username
@password = password
@@ -406,6 +406,7 @@ def make_http_request(uri, post_body, headers, http_options=nil)
if http_options
request.set_trust_ca_file(http_options[:trust_ca_file]) if http_options[:trust_ca_file]
request.set_client_cert_files(http_options[:client_cert_file], http_options[:client_cert_key_file]) if http_options[:client_cert_file] && http_options[:client_cert_key_file]
+ request.set_ssl_verify_mode(http_options[:ssl_verify_mode]) if http_options[:ssl_verify_mode]
end
headers.each do |key, value|

0 comments on commit 70efc93

Please sign in to comment.