diff options
author | mneumann <mneumann@b2dd03c8-39d4-4d8f-98ff-823fe69b080e> | 2005-06-19 15:47:31 +0000 |
---|---|---|
committer | mneumann <mneumann@b2dd03c8-39d4-4d8f-98ff-823fe69b080e> | 2005-06-19 15:47:31 +0000 |
commit | f2d933b6f15757732bb14ce15018daec0c4684fa (patch) | |
tree | ca410a50a42505c29e32d407f014c7d2a1695d63 | |
parent | 768cad63a773d7e99c4a236b36cfebbfab450687 (diff) | |
download | ruby-f2d933b6f15757732bb14ce15018daec0c4684fa.tar.gz ruby-f2d933b6f15757732bb14ce15018daec0c4684fa.tar.xz ruby-f2d933b6f15757732bb14ce15018daec0c4684fa.zip |
* lib/xmlrpc/utils.rb: Patch by Nobuhiro IMAI fixes the following
problem: Default value modification on
Module#public_instance_methods (false -> true) breaks
s.add_handler(XMLRPC::iPIMethods("sample"), MyHandler.new) style
security protection.
* lib/xmlrpc/client.rb: Aliased XMLRPC::Client#new2 as
XMLRPC::Client#new_from_uri, and #new3 as #new_from_hash.
git-svn-id: http://svn.ruby-lang.org/repos/ruby/trunk@8643 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
-rw-r--r-- | ChangeLog | 11 | ||||
-rw-r--r-- | lib/xmlrpc/client.rb | 17 | ||||
-rw-r--r-- | lib/xmlrpc/utils.rb | 2 |
3 files changed, 26 insertions, 4 deletions
@@ -1,3 +1,14 @@ +Sun Jun 19 17:22:02 CEST 2005 Michael Neumann <mneumann@ruby-lang.org> + + * lib/xmlrpc/utils.rb: Patch by Nobuhiro IMAI fixes the following + problem: Default value modification on + Module#public_instance_methods (false -> true) breaks + s.add_handler(XMLRPC::iPIMethods("sample"), MyHandler.new) style + security protection. + + * lib/xmlrpc/client.rb: Aliased XMLRPC::Client#new2 as + XMLRPC::Client#new_from_uri, and #new3 as #new_from_hash. + Sun Jun 19 14:09:07 2005 Nobuyoshi Nakada <nobu@ruby-lang.org> * gc.c (run_final): reduce unnecessary object allocation during diff --git a/lib/xmlrpc/client.rb b/lib/xmlrpc/client.rb index 226739e4b..074f5014c 100644 --- a/lib/xmlrpc/client.rb +++ b/lib/xmlrpc/client.rb @@ -69,6 +69,7 @@ call on the remote-side and of course the parameters for the remote procedure. Parameter ((|timeout|)) is the time to wait for a XML-RPC response, defaults to 30. --- XMLRPC::Client.new2( uri, proxy=nil, timeout=nil) +--- XMLRPC::Client.new_from_uri( uri, proxy=nil, timeout=nil) : uri URI specifying protocol (http or https), host, port, path, user and password. Example: https://user:password@host:port/path @@ -80,6 +81,7 @@ call on the remote-side and of course the parameters for the remote procedure. Defaults to 30. --- XMLRPC::Client.new3( hash={} ) +--- XMLRPC::Client.new_from_hash( hash={} ) Parameter ((|hash|)) has following case-insensitive keys: * host * path @@ -135,6 +137,8 @@ call on the remote-side and of course the parameters for the remote procedure. (({XMLRPC::FaultException})). Both are explained in ((<call|XMLRPC::Client#call>)). + Simple to remember: The "2" in "call2" denotes the number of values it returns. + --- XMLRPC::Client#multicall( *methods ) You can use this method to execute several methods on a XMLRPC server which supports the multi-call extension. @@ -331,7 +335,9 @@ module XMLRPC end - def self.new2(uri, proxy=nil, timeout=nil) + class << self + + def new2(uri, proxy=nil, timeout=nil) if match = /^([^:]+):\/\/(([^@]+)@)?([^\/]+)(\/.*)?$/.match(uri) proto = match[1] user, passwd = (match[3] || "").split(":") @@ -350,9 +356,10 @@ module XMLRPC self.new(host, path, port, proxy_host, proxy_port, user, passwd, (proto == "https"), timeout) end - - def self.new3(hash={}) + alias new_from_uri new2 + + def new3(hash={}) # convert all keys into lowercase strings h = {} @@ -362,6 +369,10 @@ module XMLRPC h['use_ssl'], h['timeout']) end + alias new_from_hash new3 + + end + # Attribute Accessors ------------------------------------------------------------------- diff --git a/lib/xmlrpc/utils.rb b/lib/xmlrpc/utils.rb index d542cfe4e..85c6bba37 100644 --- a/lib/xmlrpc/utils.rb +++ b/lib/xmlrpc/utils.rb @@ -131,7 +131,7 @@ module XMLRPC def get_methods(obj, delim=".") prefix = @prefix + delim - obj.class.public_instance_methods.collect { |name| + obj.class.public_instance_methods(false).collect { |name| [prefix + name, obj.method(name).to_proc, nil, nil] } end |