http server validation 
Author Message
 http server validation

I search a solution to validate remotly that a http server is alive.

Thanks for your help

Herve



Mon, 01 Mar 2004 20:16:16 GMT  
 http server validation

Quote:

>I search a solution to validate remotly that a http server is alive.

>Thanks for your help

>Herve

perl -MLWP::Simple -le 'print head "http://www.cpan.org"'
--
    This space intentionally left blank


Mon, 01 Mar 2004 20:20:55 GMT  
 http server validation

Quote:

> I search a solution to validate remotly that a http server is alive.

  % perldoc `which HEAD`
  % HEAD my.http.server

Quote:
> Thanks for your help

Be sure LWP is installed.

--
Joe Schaefer         "Experience is one thing you can't get for nothing."
                                               -- Oscar Wilde



Mon, 01 Mar 2004 20:36:32 GMT  
 http server validation

Quote:



> >I search a solution to validate remotly that a http server is alive.
> perl -MLWP::Simple -le 'print head "http://www.cpan.org"'

you don't need to print the response since head() in
scalar context tells you if it were successful or not.

perl -MLWP::Simple -le 'print "Alive!" if head "http://www.cpan.org"'

however, this can only tell you that the server is alive.  you
have to work harder to check if the server is not alive since
some servers do not handle HEAD correctly. ;)

--

CGI Meta FAQ - http://www.perl.org/CGI_MetaFAQ.html
Troubleshooting CGI scripts - http://www.perl.org/troubleshooting_CGI.html



Mon, 01 Mar 2004 21:56:06 GMT  
 http server validation

Quote:


> > I search a solution to validate remotly that a http server is alive.

>   % perldoc `which HEAD`
>   % HEAD my.http.server

this won't necessarily work since some servers do not
respond properly to a HEAD request.  if HEAD indicates that
the server is not running, then you have to try GET.

furthermore, even if the request fails you still get output
with HEAD.  you need to check the return value which indicates
the number of URLs that failed.

--

CGI Meta FAQ - http://www.perl.org/CGI_MetaFAQ.html
Troubleshooting CGI scripts - http://www.perl.org/troubleshooting_CGI.html



Mon, 01 Mar 2004 21:52:46 GMT  
 http server validation

Quote:




> > >I search a solution to validate remotly that a http server is alive.

> > perl -MLWP::Simple -le 'print head "http://www.cpan.org"'

> you don't need to print the response since head() in
> scalar context tells you if it were successful or not.

> perl -MLWP::Simple -le 'print "Alive!" if head "http://www.cpan.org"'

> however, this can only tell you that the server is alive.

More precisely- this only tells you if the server returns a _successful_
response for the requested resource.  In particular, a http server can
be "alive" without requiring the existence of "index.html".

Quote:
> you have to work harder to check if the server is not alive since some
> servers do not handle HEAD correctly. ;)

I'm not sure I understand your point here- I would think that simply
having a listener on port 80 would constitute most people's definition
of a "live" server.

Whether or not it's a proper http server is subject the requirements
of whatever HTTP version suits your fancy, but in any case *I* would
consider any listening server that responds to HTTP*.* requests
with HTTP*.* responses (successful or otherwise) to be "alive".  
Failure to return a well-formed response would indicate it's not
a "live" HTTP*.* server.

Are you suggesting there is a third category?

--
Joe Schaefer         "Experience is one thing you can't get for nothing."
                                               -- Oscar Wilde



Tue, 02 Mar 2004 01:45:36 GMT  
 http server validation

Quote:


> > you have to work harder to check if the server is not alive since some
> > servers do not handle HEAD correctly. ;)
> I'm not sure I understand your point here- I would think that simply
> having a listener on port 80 would constitute most people's definition
> of a "live" server.

if you don't get back something that can be understood as an HTTP
response, HEAD might give you a false negative.  this is something
i have had to deal with in practice, rather than theory. ;)

--

CGI Meta FAQ - http://www.perl.org/CGI_MetaFAQ.html
Troubleshooting CGI scripts - http://www.perl.org/troubleshooting_CGI.html



Tue, 02 Mar 2004 15:23:29 GMT  
 http server validation


Quote:



>> > you have to work harder to check if the server is not alive since some
>> > servers do not handle HEAD correctly. ;)

>> I'm not sure I understand your point here- I would think that simply
>> having a listener on port 80 would constitute most people's definition
>> of a "live" server.

>if you don't get back something that can be understood as an HTTP
>response, HEAD might give you a false negative.  this is something
>i have had to deal with in practice, rather than theory. ;)

Probably rare but some servers disallow HEAD and return 405...
is that the reason for the smiley.

The LWP::Simple solution would have grow less simple :)  

--
Charles DeRykus



Tue, 02 Mar 2004 19:22:42 GMT  
 http server validation
On Sep 14, Charles DeRykus inscribed on the eternal scroll:

Quote:
> Probably rare but some servers disallow HEAD and return 405...

RFC2616 section 5.1.1

  The methods GET and HEAD MUST be supported by all general-purpose
  servers.

ergo: any server which fails to support HEAD must be a special-purpose
server.   :-}

--

    "No, nothing is wrong.  It's just not doing what you want."
                                              - Dave Pawson on comp.text.xml



Tue, 02 Mar 2004 20:01:19 GMT  
 http server validation
In article

Quote:

> On Sep 14, Charles DeRykus inscribed on the eternal scroll:
> RFC2616 section 5.1.1
>   The methods GET and HEAD MUST be supported by all general-purpose
>   servers.
> ergo: any server which fails to support HEAD must be a special-purpose
> server.   :-}

of course, Alan knows the difference between compliant and non-
compliant. :)

--

CGI Meta FAQ - http://www.perl.org/CGI_MetaFAQ.html
Troubleshooting CGI scripts - http://www.perl.org/troubleshooting_CGI.html



Tue, 02 Mar 2004 21:44:49 GMT  
 http server validation
On Sep 14, brian d foy inscribed on the eternal scroll:

Quote:
> >   The methods GET and HEAD MUST be supported by all general-purpose
> >   servers.

> > ergo: any server which fails to support HEAD must be a special-purpose
> > server.   :-}

> of course, Alan knows the difference between compliant and non-
> compliant. :)

He also knows the meaning of Quod Erat Demonstrandum.  :-/

--

    "No, nothing is wrong.  It's just not doing what you want."
                                              - Dave Pawson on comp.text.xml



Wed, 03 Mar 2004 12:56:11 GMT  
 
 [ 11 post ] 

 Relevant Pages 

1. Problem invoking DOS Perl under WindowsNT http server

2. http server for perl5

3. Perl Server to notify of new http port

4. SOLUTION to: Problem executing program from a Perl script called by HTTP Server

5. Problem executing program from a Perl script called by HTTP Server

6. perl script for connecting to http servers

7. MacPerl sockets in my HTTP server

8. Slow http uploads to server from NT

9. ANNOUNCE: Simple perl http server available

10. HTTP Server using Sockets

11. Win2K Perl fork Http server

 

 
Powered by phpBB® Forum Software