Net::Ping::HTTP inconsistencies

I have multiple websites that are “up”. That is, they are accessible via
the browser and return to the user content.

But…

require ‘net/ping’
=> true
Net::Ping::HTTP.new(‘somewebsite.com’).ping?
=> false

And, sometimes (I stress, sometimes):

require ‘net/ping’
=> true
Net::Ping::HTTP.new(‘http://somewebsite.com’).ping?
=> true

But then…

require ‘net/ping’
=> true
Net::Ping::HTTP.new(‘http://somewebsite.com’).ping?
=> false

Why the inconsistency? More importantly, how can I achieve consistent
results? It’s maddening when a website is obviously functional and yet I
am told it’s not.

system(%{echo “HEAD / HTTP/1.1\nHOST: www.rabbitcreative.com\n\n” | nc
http://www.rabbitcreative.com 80})

Really? Ruby’s Net/* libraries suck, apparently.

On Apr 19, 3:33 pm, Daniel W. [email protected] wrote:

require ‘net/ping’
=> true
Net::Ping::HTTP.new(‘http://somewebsite.com’).ping?

=> false

Why the inconsistency? More importantly, how can I achieve consistent
results? It’s maddening when a website is obviously functional and yet I
am told it’s not.

Try this and see if you can determine why it’s failing sometimes:

require ‘net/ping’

http = Net::Ping::HTTP.new(‘http://somewebsite.com’)

unless http.ping?
puts "Ping failed: " + ping.exception
end

Regards,

Dan

On 04/19/2010 11:57 PM, Daniel W. wrote:

system(%{echo “HEAD / HTTP/1.1\nHOST: www.rabbitcreative.com\n\n” | nc
http://www.rabbitcreative.com 80})

Really? Ruby’s Net/* libraries suck, apparently.

On what basis do you come to this conclusion? Maybe your webserver is
not accepting all connection attempts to control the load. Maybe there
are network issues. So far I have not seen evidence that there is
something wrong with Ruby’s net library. (Btw, which version are you
using?)

Cheers

robert

On Apr 19, 3:57 pm, Daniel W. [email protected] wrote:

system(%{echo “HEAD / HTTP/1.1\nHOST:www.rabbitcreative.com\n\n” | nchttp://www.rabbitcreative.com80})

Really? Ruby’s Net/* libraries suck, apparently.

net-ping isn’t part of the Ruby standard library. There’s a ping
library, but net-ping is a different beast.

Also, your problem did inspire me to make one change, which is to
alter the Net::Ping::HTTP class so that a URI without a path assumes
‘/’ for the path.

Regards,

Dan