diff options
author | nagachika <nagachika@b2dd03c8-39d4-4d8f-98ff-823fe69b080e> | 2016-03-09 14:01:02 +0000 |
---|---|---|
committer | nagachika <nagachika@b2dd03c8-39d4-4d8f-98ff-823fe69b080e> | 2016-03-09 14:01:02 +0000 |
commit | eb4ed0ecf62658bbd96a83ce9f52b1095fb27233 (patch) | |
tree | 194057e2a7e4fef96bcb56c4aecb8cfec47be59f /lib | |
parent | 6aad84e00ba4a9eb624fce2d985b9a34feb0e0a7 (diff) |
merge revision(s) 53318: [Backport #11489]
* lib/xmlrpc/client.rb: Support SSL options in async methods of
XMLRPC::Client.
[Bug #11489]
Reported by Aleksandar Kostadinov. Thanks!!!
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/branches/ruby_2_2@54069 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
Diffstat (limited to 'lib')
-rw-r--r-- | lib/xmlrpc/client.rb | 24 |
1 files changed, 19 insertions, 5 deletions
diff --git a/lib/xmlrpc/client.rb b/lib/xmlrpc/client.rb index aab07a7f95..0947b95ef5 100644 --- a/lib/xmlrpc/client.rb +++ b/lib/xmlrpc/client.rb @@ -432,6 +432,24 @@ module XMLRPC # :nodoc: Net::HTTP.new host, port, proxy_host, proxy_port end + def dup_net_http + http = net_http(@http.address, + @http.port, + @http.proxy_address, + @http.proxy_port) + http.proxy_user = @http.proxy_user + http.proxy_pass = @http.proxy_pass + if @http.use_ssl? + http.use_ssl = true + Net::HTTP::SSL_ATTRIBUTES.each do |attribute| + http.__send__("#{attribute}=", @http.__send__(attribute)) + end + end + http.read_timeout = @http.read_timeout + http.open_timeout = @http.open_timeout + http + end + def set_auth if @user.nil? @auth = nil @@ -463,10 +481,7 @@ module XMLRPC # :nodoc: if async # use a new HTTP object for each call - http = net_http(@host, @port, @proxy_host, @proxy_port) - http.use_ssl = @use_ssl if @use_ssl - http.read_timeout = @timeout - http.open_timeout = @timeout + http = dup_net_http # post request http.start { @@ -611,4 +626,3 @@ module XMLRPC # :nodoc: end # class Client end # module XMLRPC - |