Creates an object which represents the remote XML-RPC server at the given uri. The URI should have a host, port, path, user and password.
Example: user:password@host:port/path
Raises an ArgumentError if the
uri is invalid, or if the protocol isn’t http or https.
If a proxy is given it
should be in the form of “host:port”.
The optional timeout defaults to 30 seconds.
# File lib/xmlrpc/client.rb, line 135
def new2(uri, proxy=nil, timeout=nil)
begin
url = URI(uri)
rescue URI::InvalidURIError => e
raise ArgumentError, e.message, e.backtrace
end
unless URI::HTTP === url
raise ArgumentError, "Wrong protocol specified. Only http or https allowed!"
end
proto = url.scheme
user = url.user
passwd = url.password
host = url.host
port = url.port
path = url.path.empty? ? nil : url.request_uri
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