Net::Ping::HTTP inconsistencies

D

Daniel Waite

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

But...
=> false

And, sometimes (I stress, _sometimes_):
=> true

But then...
=> 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.
 
D

Daniel Berger

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

But...


=3D> false

And, sometimes (I stress, _sometimes_):


=3D> true

But then...


=3D> 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 =3D Net::ping::HTTP.new('http://somewebsite.com')

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

Regards,

Dan
 
R

Robert Klemme

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
 
D

Daniel Berger

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
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

Forum statistics

Threads
474,156
Messages
2,570,878
Members
47,413
Latest member
KeiraLight

Latest Threads

Top