aboutsummaryrefslogtreecommitdiffstats
path: root/lib/xmlrpc
diff options
context:
space:
mode:
authortenderlove <tenderlove@b2dd03c8-39d4-4d8f-98ff-823fe69b080e>2012-03-02 23:12:32 +0000
committertenderlove <tenderlove@b2dd03c8-39d4-4d8f-98ff-823fe69b080e>2012-03-02 23:12:32 +0000
commit60282ebfe5ddb283fc2312fb6a2ce9e928cb2ad9 (patch)
treebff5d6fbdbcdb4fc54473d838b0262315a213e38 /lib/xmlrpc
parentb854733d518fcd72b14cea5d7fed6512550a3572 (diff)
downloadruby-60282ebfe5ddb283fc2312fb6a2ce9e928cb2ad9.tar.gz
* lib/xmlrpc/client.rb (new2): fix custom port specification when an
SSL uri is used. * test/xmlrpc/test_client.rb: tests for XMLRPC::Client.new2 git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@34882 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
Diffstat (limited to 'lib/xmlrpc')
-rw-r--r--lib/xmlrpc/client.rb8
1 files changed, 7 insertions, 1 deletions
diff --git a/lib/xmlrpc/client.rb b/lib/xmlrpc/client.rb
index 968292b077..b9d4affeb2 100644
--- a/lib/xmlrpc/client.rb
+++ b/lib/xmlrpc/client.rb
@@ -279,6 +279,7 @@ require "xmlrpc/create"
require "xmlrpc/config"
require "xmlrpc/utils" # ParserWriterChooseMixin
require "net/http"
+require "uri"
module XMLRPC
@@ -344,15 +345,20 @@ module XMLRPC
host, port = match[4].split(":")
path = match[5]
- if proto != "http" and proto != "https"
+ case proto
+ when 'http' then port ||= 80
+ when 'https' then port ||= 443
+ else
raise "Wrong protocol specified. Only http or https allowed!"
end
+ port = port.to_i
else
raise "Wrong URI as parameter!"
end
proxy_host, proxy_port = (proxy || "").split(":")
+ proxy_port = proxy_port.to_i if proxy_port
self.new(host, path, port, proxy_host, proxy_port, user, passwd, (proto == "https"), timeout)
end