简体   繁体   English

服务器关闭时,Ruby HTTP中断

[英]Ruby HTTP breaks when server is off

Net::HTTP gives a "undefined method `closed?' Net :: HTTP给出了“未定义的方法'closed?' for nil:NilClass" if the server is down... is this a standard response that I can trust? for nil:NilClass“如果服务器已关闭...这是我可以信任的标准响应吗? Shouldnt it raise a Net:* exception? 它不应该引发Net:*异常吗?

Regards 问候

It should return something like this: 它应该返回如下内容:

/usr/lib/ruby/1.8/net/http.rb:560:in `initialize': getaddrinfo: Name or service not known (SocketError)
from /usr/lib/ruby/1.8/net/http.rb:560:in `open'
from /usr/lib/ruby/1.8/net/http.rb:560:in `connect'
from /usr/lib/ruby/1.8/timeout.rb:53:in `timeout'
from /usr/lib/ruby/1.8/timeout.rb:93:in `timeout'
from /usr/lib/ruby/1.8/net/http.rb:560:in `connect'
from /usr/lib/ruby/1.8/net/http.rb:553:in `do_start'
from /usr/lib/ruby/1.8/net/http.rb:542:in `start'
from /usr/lib/ruby/1.8/net/http.rb:374:in `get_response'
from /usr/lib/ruby/1.8/net/http.rb:356:in `get'
from httpd.rb:2

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM