diff options
author | nobu <nobu@b2dd03c8-39d4-4d8f-98ff-823fe69b080e> | 2011-05-18 14:09:38 +0000 |
---|---|---|
committer | nobu <nobu@b2dd03c8-39d4-4d8f-98ff-823fe69b080e> | 2011-05-18 14:09:38 +0000 |
commit | 7dd49ed5a78a2631f1a59635b1a0d6b9e18193cf (patch) | |
tree | 7c7a3d126015188649f3af4132d9eed64bf769b1 /lib/xmlrpc/README.rdoc | |
parent | 48553e9c587e3f83d7d2823f1f7164e04bb27cf9 (diff) | |
download | ruby-7dd49ed5a78a2631f1a59635b1a0d6b9e18193cf.tar.gz |
* lib: remove trailing spaces.
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@31630 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
Diffstat (limited to 'lib/xmlrpc/README.rdoc')
-rw-r--r-- | lib/xmlrpc/README.rdoc | 46 |
1 files changed, 23 insertions, 23 deletions
diff --git a/lib/xmlrpc/README.rdoc b/lib/xmlrpc/README.rdoc index 221d675219..2faed28cb9 100644 --- a/lib/xmlrpc/README.rdoc +++ b/lib/xmlrpc/README.rdoc @@ -59,7 +59,7 @@ use the client and implement a server. * REXML (REXMLStreamParser) * xml-scan (XMLScanStreamParser) * Fastest parser is Expat's XMLStreamParser! - + * General * possible to choose between XMLParser module (Expat wrapper) and REXML/NQXML (pure Ruby) parsers * Marshalling Ruby objects to Hashs and reconstruct them later from a Hash @@ -70,7 +70,7 @@ use the client and implement a server. === Client require "xmlrpc/client" - + # Make an object to represent the XML-RPC server. server = XMLRPC::Client.new( "xmlrpc-c.sourceforge.net", "/api/sample.php") @@ -86,7 +86,7 @@ use the client and implement a server. There are two possible ways, of handling a fault-structure: -==== by catching a XMLRPC::FaultException exception +==== by catching a XMLRPC::FaultException exception require "xmlrpc/client" @@ -107,7 +107,7 @@ There are two possible ways, of handling a fault-structure: puts e.faultCode puts e.faultString end - + ==== by calling "call2" which returns a boolean require "xmlrpc/client" @@ -128,7 +128,7 @@ There are two possible ways, of handling a fault-structure: puts result.faultCode puts result.faultString end - + === Client using Proxy You can create a +Proxy+ object onto which you can call methods. This way it @@ -137,7 +137,7 @@ looks nicer. Both forms, _call_ and _call2_ are supported through _proxy_ and given to each XML-RPC call using that Proxy. require "xmlrpc/client" - + # Make an object to represent the XML-RPC server. server = XMLRPC::Client.new( "xmlrpc-c.sourceforge.net", "/api/sample.php") @@ -167,7 +167,7 @@ can be mixed: s.add_handler("sample.sumAndDifference") do |a,b| { "sum" => a + b, "difference" => a - b } end - + s.serve ==== Java-like (handler classes) @@ -181,8 +181,8 @@ can be mixed: { "sum" => a + b, "difference" => a - b } end end - - # NOTE: Security Hole (read below)!!! + + # NOTE: Security Hole (read below)!!! s.add_handler("sample", MyHandler.new) s.serve @@ -195,17 +195,17 @@ To return a fault-structure you have to raise an FaultException e.g.: From Brian Candler: - Above code sample has an extremely nasty security hole, in that you can now call - any method of 'MyHandler' remotely, including methods inherited from Object - and Kernel! For example, in the client code, you can use - - puts server.call("sample.send","`","ls") - - (backtick being the method name for running system processes). Needless to - say, 'ls' can be replaced with something else. - - The version which binds proc objects (or the version presented below in the next section) - doesn't have this problem, but people may be tempted to use the second version because it's + Above code sample has an extremely nasty security hole, in that you can now call + any method of 'MyHandler' remotely, including methods inherited from Object + and Kernel! For example, in the client code, you can use + + puts server.call("sample.send","`","ls") + + (backtick being the method name for running system processes). Needless to + say, 'ls' can be replaced with something else. + + The version which binds proc objects (or the version presented below in the next section) + doesn't have this problem, but people may be tempted to use the second version because it's so nice and 'Rubyesque'. I think it needs a big red disclaimer. @@ -225,7 +225,7 @@ A solution is to undef insecure methods or to use (({XMLRPC::iPIMethods})) as sh # ... -This adds only public instance methods explicitly declared in class MyHandler +This adds only public instance methods explicitly declared in class MyHandler (and not those inherited from any other class). ==== With interface declarations @@ -271,7 +271,7 @@ XML parser, then you have to call the <i>set_parser</i> method of <tt>XMLRPC::BasicServer</tt> or by editing xmlrpc/config.rb. Client Example: - + # ... server = XMLRPC::Client.new( "xmlrpc-c.sourceforge.net", "/api/sample.php") server.set_parser(XMLRPC::XMLParser::XMLParser.new) @@ -283,7 +283,7 @@ Server Example: s = XMLRPC::CGIServer.new s.set_parser(XMLRPC::XMLParser::XMLStreamParser.new) # ... - + or: # ... |