H
Hubert Martin-deidier
Hello all,
I try to transfer binary files between two (Redmine) servers. By the
way, I use the ruby language to do it and all informations are exchanged
through the XML-RPC protocol.
Unfortunatly everything success except that transfered binary files
doesn't work. For instance a word file can not be open.
If I compare the original binary file with the transfered binary file, I
can see that everything is similar except that the 'CR' character is
always replaced with a 'LF' character and 'CR LF' characters are always
replaced with 'LF' characters.
I open the file on local server in this way :
binary_content_to_transfer = File.open(binary_file_path_path,"rb")
{|io| io.read}
I transfer the binary_content_to_transfer with either :string (I also
try with [:base64] but same problem occurs)
On remote server, I save content int this way :
binary_remote_file = File.new(binary_remote_file_path, "wb")
binary_remote_file.write(binary_content_to_transfer)
attachment_file.close
I also try many other adjustments to understand where is the "mistake".
All the tests that I made let me think that the XML-RPC protocol is
responsible of the problem :
- I try to execute directly the same read and write code (without using
the XMLRPC procedure) => The created file is perfectly similar with the
original one.
- I try to use different types for transfering data
string and
:base64) => Result is the same.
- I try different way of reading and writing files (wb, w, rb, r) =>
Result is worst.
Is anyone has an idea or an alternative solution to transfer binary
files ?
Thanks in advance.
I try to transfer binary files between two (Redmine) servers. By the
way, I use the ruby language to do it and all informations are exchanged
through the XML-RPC protocol.
Unfortunatly everything success except that transfered binary files
doesn't work. For instance a word file can not be open.
If I compare the original binary file with the transfered binary file, I
can see that everything is similar except that the 'CR' character is
always replaced with a 'LF' character and 'CR LF' characters are always
replaced with 'LF' characters.
I open the file on local server in this way :
binary_content_to_transfer = File.open(binary_file_path_path,"rb")
{|io| io.read}
I transfer the binary_content_to_transfer with either :string (I also
try with [:base64] but same problem occurs)
On remote server, I save content int this way :
binary_remote_file = File.new(binary_remote_file_path, "wb")
binary_remote_file.write(binary_content_to_transfer)
attachment_file.close
I also try many other adjustments to understand where is the "mistake".
All the tests that I made let me think that the XML-RPC protocol is
responsible of the problem :
- I try to execute directly the same read and write code (without using
the XMLRPC procedure) => The created file is perfectly similar with the
original one.
- I try to use different types for transfering data
:base64) => Result is the same.
- I try different way of reading and writing files (wb, w, rb, r) =>
Result is worst.
Is anyone has an idea or an alternative solution to transfer binary
files ?
Thanks in advance.