Beefy Boxes and Bandwidth Generously Provided by pair Networks
Keep It Simple, Stupid
 
PerlMonks  

Re: Test Availability of HTTPS Web Application?

by Kanji (Parson)
on May 28, 2002 at 23:57 UTC ( [id://169935]=note: print w/replies, xml ) Need Help??


in reply to Test Availability of HTTPS Web Application?

I'm not sure why you need to 'reverse engineer' legacy Perl code (decipher, maybe ;^), but your right in thinking there's a better way ... well, simpler anyway.

#!/usr/bin/perl -w use strict; use LWP::UserAgent; use HTTP::Request::Common qw/ GET /; my $url = shift; my $browser = LWP::UserAgent->new; my $response = $browser->request( GET $url ); print $response->code;

Personally, I think $response->is_success would be more beneficial as 200 isn't the only response indicating success, but that's your call...

One caveat, tho:- test against a known good site before anything else ... LWP::UserAgent returns a 500 error instead of undef if you don't have have the modules necessary to talk to SSL (aka https) servers.

    --k.


Replies are listed 'Best First'.
Re: Re: Test Availability of HTTPS Web Application?
by Beau Landeaux (Novice) on May 29, 2002 at 02:57 UTC
    You're correct, "is_success" is MUCH better (I'm catchin' on.) Here's the rub: https, repeat 's'. Beau
      Go to the link mentioned as "required modules", i.e. Crypt::SSLeay: "OpenSSL glue that provides LWP https support"

Log In?
Username:
Password:

What's my password?
Create A New User
Domain Nodelet?
Node Status?
node history
Node Type: note [id://169935]
help
Chatterbox?
and the web crawler heard nothing...

How do I use this?Last hourOther CB clients
Other Users?
Others sharing their wisdom with the Monastery: (4)
As of 2024-04-19 13:52 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    No recent polls found