On Jun 24, 2008, at 6:38 PM, Dario Meloni wrote: >>> I have made a patch to the XMLRPC implementation used in Ruby to >>> allow more flexibility in it's usage. I have developed this to let >> the developer choose which transport system to use. The http >>> implementation is normally used, but for some needs i had to use >>> local domain sockets. >> Do you have any idea how common this usage is? I really don't >> know, having never encountered it personally. > > In fact i fear that it is not commonly used, but standard library > should > be general purpose isn't it? Yeah, you're right. We also just need to weight that against factors ike increased maintenance. We're not talking about a lot of code 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 > gem that adds the needed functionality. Those who need it could >> 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 optional) methods, changing do_rpc accordingly, is a simpler way. Yeah, it looks like this code is young and still evolving. Perhaps it ould be good to release it as a gem for six months, see if you get any feedback on it, and then discuss integration. Does that make sense to you? >>> require 'xmlrpc/client' > > module XMLRPC > class ClientS < XMLRPC::Client > def initialize(info) > @info = info > end > > private > > # create new socket > def new_socket(info,async) > raise "Must be subclassed" That might be better as: raise NotImplementedError, " > > end > > # write xmlrpc request in the previously created socket > def write_request(socket,request) > if socket.write(request) != 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 = new_socket(@info,async) > write_request(sock,request) > return read_response(sock) > end > end > end