1
0
Fork 0
mirror of https://github.com/ruby/ruby.git synced 2022-11-09 12:17:21 -05:00

* lib: remove trailing spaces.

git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@31630 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
This commit is contained in:
nobu 2011-05-18 14:09:38 +00:00
parent 48553e9c58
commit 7dd49ed5a7
7 changed files with 53 additions and 53 deletions

View file

@ -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.
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
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
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:
# ...