在ruby XMLRPC中设置响应超时不起作用

时间:2013-11-25 08:54:38

标签: ruby timeout xml-rpc confluence

我正在尝试以编程方式将大型(10+ MB)文件上载到支持XMLRPC的服务器。

对于那些感兴趣的人,背景是:

代码看起来像这样

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")

我知道XMLRPC客户端在中止之前会等待TIMEOUT秒。因此,在尝试上传大文件时,我得到以下响应很自然(较小的文件不会抛出此错误)。

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'

但是,我无法正确设置响应超时。我试过了

两者都不奏效。我已经验证客户端仍然等待响应的默认30秒,然后抛出错误。 那么,我做错了什么?

0 个答案:

没有答案