Skip to content

Commit

Permalink
Merge branch 'master' of https://github.com/tjgfernandes/handsoap
Browse files Browse the repository at this point in the history
  • Loading branch information
Tim Warberg committed Apr 20, 2012
2 parents 48d2ef5 + 445214a commit 70efc93
Show file tree
Hide file tree
Showing 3 changed files with 7 additions and 1 deletion.
1 change: 1 addition & 0 deletions lib/handsoap/http/drivers/http_client_driver.rb
Expand Up @@ -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] }
Expand Down
6 changes: 5 additions & 1 deletion lib/handsoap/http/request.rb
Expand Up @@ -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
Expand All @@ -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
Expand All @@ -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
Expand Down
1 change: 1 addition & 0 deletions lib/handsoap/service.rb
Expand Up @@ -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|
Expand Down

0 comments on commit 70efc93

Please sign in to comment.