On Jun 24, 2008, at 6:38 PM, Dario Meloni wrote:

>>> I have made a patch to the XMLRPC implementation used in Ruby to =20
>>> allow more flexibility in it's usage. I have developed this to let =20=

>>> the developer choose which transport system to use. The http =20
>>> implementation is normally used, but for some needs i had to use =20
>>> local domain sockets.
>> Do you have any idea how common this usage is?  I really don't =20
>> know, having never encountered it personally.
>
> In fact i fear that it is not commonly used, but standard library =20
> should
> be general purpose isn't it?

Yeah, you're right.  We also just need to weight that against factors =20=

like increased maintenance.  We're not talking about a lot of code =20
here though, so it's not too big a deal.

>> If it's not super common, I'm wondering if it would be better as a =20=

>> gem that adds the needed functionality.  Those who need it could =20
>> install the gem and modify their require statement.  Just a thought.
>
> I rewrote it as a class, and in fact it is a more ruby style approach,
> without socket factories which made it a lot like java's approach.
> Exposing new_socket (mandatory) and read_response and write_request =20=

> (optional) methods, changing do_rpc accordingly, is a simpler way.

Yeah, it looks like this code is young and still evolving.  Perhaps it =20=

would be good to release it as a gem for six months, see if you get =20
any feedback on it, and then discuss integration.  Does that make =20
sense to you?

>>> require 'xmlrpc/client'
>
> module XMLRPC
>    class ClientS < XMLRPC::Client
>        def initialize(info)
>            @info =3D info
>        end
>
>        private
>
>        # create new socket
>        def new_socket(info,async)
>            raise "Must be subclassed"

That might be better as:

   raise NotImplementedError, "=85"

>
>        end
>
>        # write xmlrpc request in the previously created socket
>        def write_request(socket,request)
>          if socket.write(request) !=3D request.length then
>              raise "Not all the data has been sent"
>          end
>        end
>
>        # read response from the socket
>        def read_response(socket)
>            socket.read()
>        end
>
>        # do_rpc working with custom sockets
>        def do_rpc( request, async )
>          sock =3D new_socket(@info,async)
>          write_request(sock,request)
>          return read_response(sock)
>        end
>    end
> end

James Edward Gray II=