# Append mandatory urls to check
@http_urls = ( @http_urls, @{$HOSTS_ALL{'http_urls'}} );
- my( $file, $tmessage ) = ( "", "" );
+ my( $file, $tmessage, $method ) = ( "", "" );
my( $color, $summary ) = ( "green", "" );
# If HTTP URLS are defined use the URL check
if ( @http_urls ) {
foreach my $url (@http_urls) {
# Parse the URL into it's components
- $url =~ s|^http://||; # Remove the protocol id if present
+ $url =~ s|^([A-Z]+ )?http://||; # Remove the protocol id if present
+ $method = $1 || "HEAD";
my($hpart,$urlpath) = ( $url =~ m|^([^/]+)(/.*)| );
my($hname,$port) = split(/:/,$hpart);
$port = 80 if ! $port;
my $message =
&check_tcp( $hname, $port,
- "HEAD $urlpath HTTP/1.1\r\nHost: $hname:$port\r\n\r\n", 10 );
+ "$method $urlpath HTTP/1.1\r\nHost: $hname:$port\r\n\r\n", 10 );
if( $message =~ /HTTP\S+\s+(\d\d\d)\s.*$/m ) {
my $code = $1;
if( $color ne "red" ) {
$color = "yellow"; $summary = "can't determine status code";}
}
- $tmessage .= "->HEAD $urlpath HTTP/1.1\nHost: $hname:$port\n$message\n\n";
+ $tmessage .= "->$method $urlpath HTTP/1.1\nHost: $hname:$port\n$message\n\n";
}
} else {