Class | Net::Ping::HTTP |
In: |
lib/net/ping/http.rb
|
Parent: | Ping |
follow_redirect | -> | follow_redirect? |
host | -> | uri |
host= | -> | uri= |
follow_redirect | [RW] | By default an http ping will follow a redirect and give you the result of the final URI. If this value is set to false, then it will not follow a redirect and will return false immediately on a redirect. |
user_agent | [RW] | Sets the user agent used for the HTTP request to a custom one. |
Creates and returns a new Ping::HTTP object. Note that the default port for Ping::HTTP is 80.
Looks for an HTTP response from the URI passed to the constructor. If the result is a kind of Net::HTTPSuccess then the ping was successful and true is returned. Otherwise, false is returned and the Ping::HTTP#exception method should contain a string indicating what went wrong.
If the HTTP#follow_redirect accessor is set to true (which it is by default) and a redirect occurs during the ping, then the HTTP#warning attribute is set to the redirect message, but the return result is still true. If it‘s set to false then a redirect response is considered a failed ping.
If no file or path is specified in the URI, then ’/’ is assumed.