This is a multi-part message in MIME format. --------------010505080906070306030004 Content-Type: text/plain; charset=ISO-8859-1; format=flowed Content-Transfer-Encoding: 7bit >> 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? > 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. >> To obtain this i have added support for socket factories. >> There is a new initialization method to set the socket factory (and >> new3 has been adapted) and the initialize method has 10 arguments now. >> The main difference is in the do_rpc method that will issue e new >> socket from the factory and write the request to it and will read the >> answer. The limitation is that since there is no protocol the socket >> must be closed to end the communication. > > One of your comments seems to imply that you're not too sure of the > implementation. Are we confident enough to include this with Ruby? In fact, there were old comments i forgot to remove... it works, but the limitation is for real,anyway writing it as a gem made it even easier to change the answer managment. > Would it be possible to add some tests in test/xmlrpc/ for this new > functionality? They can be easily done, but i don't think it is the case right now. I'll post it on rubyforge if it can't be inserted in the library. I have added as attachment the class i wrote instead of patching the already existing one. If it is good i'll provide any required test. --------------010505080906070306030004 Content-Type: text/plain; x-mac-type="0"; x-mac-creator="0"; name mlrpcs.rb" Content-Transfer-Encoding: 7bit Content-Disposition: inline; filename mlrpcs.rb" require 'xmlrpc/client' module XMLRPC class ClientS < XMLRPC::Client def initialize(info) @info nfo end private # create new socket def new_socket(info,async) raise "Must be subclassed" end # write xmlrpc request in the previously created socket def write_request(socket,request) if socket.write(request) ! equest.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 ew_socket(@info,async) write_request(sock,request) return read_response(sock) end end end --------------010505080906070306030004--