I am trying to programmatically upload a large-sized (10+ MB) file to a server that supports XMLRPC.
For those interested, the background is:
- The server is Confluence.
- I am trying to upload a file as attachment to a Confluence page.
- I am using the Confluence XMLRPC API. The API call is addAttachment.
The code looks something like this
require 'xmlrpc/client'
server = XMLRPC::Client.new2(server_url,"",600) # one attempt to set timeout
server.instance_variable_get(:@http).instance_variable_set(:@verify_mode, OpenSSL::SSL::VERIFY_NONE)
server.timeout=6000 # another attempt to set timeout
@conf = server.proxy("confluence2")
I know that the XMLRPC client will wait for TIMEOUT
seconds before it aborts. So its natural that I got the following response when trying to upload the large file (smaller files don't throw this error).
C:/Ruby193/lib/ruby/1.9.1/openssl/buffering.rb:318:in `syswrite': An established connection was aborted by the software
in your host machine. (Errno::ECONNABORTED)
from C:/Ruby193/lib/ruby/1.9.1/openssl/buffering.rb:318:in `do_write'
from C:/Ruby193/lib/ruby/1.9.1/openssl/buffering.rb:336:in `write'
from C:/Ruby193/lib/ruby/1.9.1/net/protocol.rb:199:in `write0'
from C:/Ruby193/lib/ruby/1.9.1/net/protocol.rb:173:in `block in write'
from C:/Ruby193/lib/ruby/1.9.1/net/protocol.rb:190:in `writing'
from C:/Ruby193/lib/ruby/1.9.1/net/protocol.rb:172:in `write'
from C:/Ruby193/lib/ruby/1.9.1/net/http.rb:1938:in `send_request_with_body'
from C:/Ruby193/lib/ruby/1.9.1/net/http.rb:1920:in `exec'
However, I am unable to properly set the response timeout. I have tried
Neither of which work. I have verified that the client still waits the default 30 seconds for the response, and then throws the error. So, what am I doing wrong?