1#!/usr/bin/perl 2 3use lib qw(lib); 4use LWP::UserAgent; 5use Getopt::Long; 6use strict; 7use vars qw($opt_proxy $opt_debug $opt_cert $opt_key $opt_cafile $opt_cadir); 8use Data::Dumper qw(Dumper); 9 10GetOptions( 11 'd' => \$opt_debug, 12 'p:s' => \$opt_proxy, 13 'proxy:s' => \$opt_proxy, 14 'cert:s' => \$opt_cert, 15 'key:s' => \$opt_key, 16 'CAfile:s' => \$opt_cafile, 17 'CAdir:s' => \$opt_cadir, 18 ); 19 20if($opt_debug) { 21 eval "use LWP::Debug qw(+);"; 22} 23 24# PROXY SUPPORT 25$ENV{HTTPS_PROXY} = $opt_proxy; 26$ENV{HTTPS_DEBUG} = $opt_debug; 27 28$ENV{HTTPS_CERT_FILE} = $opt_cert; 29$ENV{HTTPS_KEY_FILE} = $opt_key; 30 31$opt_cafile && ( $ENV{HTTPS_CA_FILE} = $opt_cafile ); 32$opt_cadir && ( $ENV{HTTPS_CA_DIR} = $opt_cadir ); 33 34my $url = shift || 'https://www.nodeworks.com'; 35my $ua = new LWP::UserAgent; 36$ua->timeout(15); 37my $req = new HTTP::Request('HEAD', $url); 38my $res = $ua->request($req); 39 40print Dumper($res); 41