X-Git-Url: https://git.donarmstrong.com/?a=blobdiff_plain;f=src%2FModules%2FHTTPDtype.pl;h=c5b56857caf9d103bd87f4b853d313d02ba47a61;hb=40f6dad8bfd5a8a707a69cb31ba62cc6d26139c1;hp=ac60d61072f5c9f134a641619dbcfa8e9fbed1e9;hpb=08424c9191b4c7d7be2446239d651e21d636644c;p=infobot.git diff --git a/src/Modules/HTTPDtype.pl b/src/Modules/HTTPDtype.pl index ac60d61..c5b5685 100644 --- a/src/Modules/HTTPDtype.pl +++ b/src/Modules/HTTPDtype.pl @@ -8,26 +8,28 @@ use strict; package HTTPDtype; sub HTTPDtype { - my($HOST) = @_; - my($line) = ''; - my($code, $mess, %h); + my ($HOST) = @_; + my ($line) = ''; + my ( $code, $mess, %h ); # TODO: remove leading http:// and trailing :port and /foo if found $HOST = 'joeysmith.com' unless length($HOST) > 0; return unless &::loadPerlModule("Net::HTTP::NB"); return unless &::loadPerlModule("IO::Select"); - my $s = Net::HTTP::NB->new(Host => $HOST) || return; - $s->write_request(HEAD => "/"); + my $s = Net::HTTP::NB->new( Host => $HOST ) || return; + $s->write_request( HEAD => "/" ); - my $sel = IO::Select->new($s); - $line = 'Header timeout' unless $sel->can_read(10); - ($code, $mess, %h) = $s->read_response_headers; + my $sel = IO::Select->new($s); + $line = 'Header timeout' unless $sel->can_read(10); + ( $code, $mess, %h ) = $s->read_response_headers; - $line = (length($h{Server}) > 0) ? $h{Server} : - "Couldn't fetch headers from $HOST"; + $line = + ( length( $h{Server} ) > 0 ) + ? $h{Server} + : "Couldn't fetch headers from $HOST"; - &::performStrictReply($line||'Unknown Error Condition'); + &::performStrictReply( $line || 'Unknown Error Condition' ); } 1;