summaryrefslogtreecommitdiff
path: root/lib
diff options
context:
space:
mode:
authornaruse <naruse@b2dd03c8-39d4-4d8f-98ff-823fe69b080e>2016-03-29 05:43:04 +0000
committernaruse <naruse@b2dd03c8-39d4-4d8f-98ff-823fe69b080e>2016-03-29 05:43:04 +0000
commit1178844958750b4143105200ea68610e44d9f5ed (patch)
treeb7c80f687855ab65b8a0b1a9287390bc1698bdf5 /lib
parent4b183abd8cabfc5ad12db8db518a8dae05da25f4 (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_3@54359 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
Diffstat (limited to 'lib')
-rw-r--r--lib/xmlrpc/client.rb24
1 files changed, 19 insertions, 5 deletions
diff --git a/lib/xmlrpc/client.rb b/lib/xmlrpc/client.rb
index 3cb9e9a9e9..587a80bea3 100644
--- a/lib/xmlrpc/client.rb
+++ b/lib/xmlrpc/client.rb
@@ -433,6 +433,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
@@ -464,10 +482,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 {
@@ -612,4 +627,3 @@ module XMLRPC # :nodoc:
end # class Client
end # module XMLRPC
-