3

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 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?

Vish
  • 2,144
  • 5
  • 25
  • 48
  • Is there any chance that someone limited the attachment size you can include on a page in confluence? – MNRSullivan Nov 25 '13 at 19:07
  • Thats a fair point; but I checked that manual uploads work fine. I should have mentioned that this is on Windows. Ill try to find a Linux system to try this on; that way I can eliminate the OS as the cause. – Vish Nov 26 '13 at 04:23
  • Have the same issue. `XMLRPC::Client` raise `Timeout::Error` only after 30s, although I set timeout equals 3s. Most likely that the problem is in underlying `Net::HTTP` – user20140268 Nov 28 '13 at 12:22
  • Yes. I tried looking at the source of various XMLRPC Client rb files, to check what timeouts are set. But looks like only `read_timeout` and `open_timeout` are set? – Vish Nov 28 '13 at 12:27

0 Answers0