B
BJ Dierkes
Hello List...
Ruby: 1.8.6
Mongrel= 1.0.1
I have created a Ruby XMLRPC server (xmlrpc4r with mongrel) that is
working great. Now I am working on posting large files that are
base64 encoded and am having problems. The following is a sample of
how the Mongrel/XMLRPC is setup and a sample handler:
======================================================================
class XMLRPCHandler < Mongrel::HttpHandler
def initialize()
@xmlrpc_server = XMLRPC::BasicServer.new
[...]
end
[...]
end
@handler = XMLRPCHandler.new()
@handler.xmlrpc_server.add_handler('file_transfer') do | token,
source_name, encoded_source, source_md5 |
[...]
end
======================================================================
Note that The code within the handler is un-important... since the
transfer fails before anything within the block is called. On the
client side I have something like:
======================================================================
if(File.exists?(self.source))
source_name = File.basename(source)
encoded_source = ''
data = ''
File.open(source) do |f|
data = f.read
end
source_md5 = Digest::MD5.hexdigest(data)
encoded_source = Base64.encode64(data)
else
raise ArgumentError, "source file [#{source}] does not exist!"
end
res = @server.call('file_transfer', @session.token, source_name,
encoded_source, source_md5)
======================================================================
When performing this call with a small text file, everything works as
expected, md5sums match... etc. However, I am trying to transfer RPM
files... the smallest of which is around 500K (not that big). Upon
attempting to transfer I get the following error:
Sun Sep 16 17:50:52 -0500 2007: ERROR: undefined method `string' for
#<File:/tmp/mongrel.16916.0>
Like I said, everything works fine for a rather small text file... I
then tried with just a simple file created from /dev/zero. At a size
of 64K the file transfers fine. At 128K I again get the error above.
I'm wondering, is there some sort of limit that anyone can explain
with regards to Mongrel and/or XMLRPC?
Any feedback is much appreciated.
Thank you.
Confidentiality Notice: This e-mail message (including any attached or
embedded documents) is intended for the exclusive and confidential use of the
individual or entity to which this message is addressed, and unless otherwise
expressly indicated, is confidential and privileged information of Rackspace
Managed Hosting. Any dissemination, distribution or copying of the enclosed
material is prohibited. If you receive this transmission in error, please
notify us immediately by e-mail at (e-mail address removed), and delete the
original message. Your cooperation is appreciated.
Ruby: 1.8.6
Mongrel= 1.0.1
I have created a Ruby XMLRPC server (xmlrpc4r with mongrel) that is
working great. Now I am working on posting large files that are
base64 encoded and am having problems. The following is a sample of
how the Mongrel/XMLRPC is setup and a sample handler:
======================================================================
class XMLRPCHandler < Mongrel::HttpHandler
def initialize()
@xmlrpc_server = XMLRPC::BasicServer.new
[...]
end
[...]
end
@handler = XMLRPCHandler.new()
@handler.xmlrpc_server.add_handler('file_transfer') do | token,
source_name, encoded_source, source_md5 |
[...]
end
======================================================================
Note that The code within the handler is un-important... since the
transfer fails before anything within the block is called. On the
client side I have something like:
======================================================================
if(File.exists?(self.source))
source_name = File.basename(source)
encoded_source = ''
data = ''
File.open(source) do |f|
data = f.read
end
source_md5 = Digest::MD5.hexdigest(data)
encoded_source = Base64.encode64(data)
else
raise ArgumentError, "source file [#{source}] does not exist!"
end
res = @server.call('file_transfer', @session.token, source_name,
encoded_source, source_md5)
======================================================================
When performing this call with a small text file, everything works as
expected, md5sums match... etc. However, I am trying to transfer RPM
files... the smallest of which is around 500K (not that big). Upon
attempting to transfer I get the following error:
Sun Sep 16 17:50:52 -0500 2007: ERROR: undefined method `string' for
#<File:/tmp/mongrel.16916.0>
Like I said, everything works fine for a rather small text file... I
then tried with just a simple file created from /dev/zero. At a size
of 64K the file transfers fine. At 128K I again get the error above.
I'm wondering, is there some sort of limit that anyone can explain
with regards to Mongrel and/or XMLRPC?
Any feedback is much appreciated.
Thank you.
Confidentiality Notice: This e-mail message (including any attached or
embedded documents) is intended for the exclusive and confidential use of the
individual or entity to which this message is addressed, and unless otherwise
expressly indicated, is confidential and privileged information of Rackspace
Managed Hosting. Any dissemination, distribution or copying of the enclosed
material is prohibited. If you receive this transmission in error, please
notify us immediately by e-mail at (e-mail address removed), and delete the
original message. Your cooperation is appreciated.