This commit is contained in:
garnier-quentin 2014-04-24 12:06:10 +02:00
parent 099aee5b38
commit 04e378c76b
6 changed files with 11 additions and 6 deletions

View File

@ -51,7 +51,7 @@ sub new {
$options{options}->add_options(arguments =>
{
"hostname:s" => { name => 'hostname' },
"port:s" => { name => 'port', default => '80' },
"port:s" => { name => 'port', },
"proto:s" => { name => 'proto', default => "http" },
"urlpath:s" => { name => 'url_path', default => "/server-status/?auto" },
"credentials" => { name => 'credentials' },

View File

@ -52,7 +52,7 @@ sub new {
$options{options}->add_options(arguments =>
{
"hostname:s" => { name => 'hostname' },
"port:s" => { name => 'port', default => '80' },
"port:s" => { name => 'port', },
"proto:s" => { name => 'proto', default => "http" },
"urlpath:s" => { name => 'url_path', default => "/server-status/?auto" },
"credentials" => { name => 'credentials' },

View File

@ -52,7 +52,7 @@ sub new {
$options{options}->add_options(arguments =>
{
"hostname:s" => { name => 'hostname' },
"port:s" => { name => 'port', default => '80' },
"port:s" => { name => 'port', },
"proto:s" => { name => 'proto', default => "http" },
"urlpath:s" => { name => 'url_path', default => "/server-status/?auto" },
"credentials" => { name => 'credentials' },

View File

@ -51,7 +51,7 @@ sub new {
$options{options}->add_options(arguments =>
{
"hostname:s" => { name => 'hostname' },
"port:s" => { name => 'port', default => '80' },
"port:s" => { name => 'port', },
"proto:s" => { name => 'proto', default => "http" },
"urlpath:s" => { name => 'url_path', default => "/server-status/?auto" },
"credentials" => { name => 'credentials' },

View File

@ -51,7 +51,7 @@ sub new {
$options{options}->add_options(arguments =>
{
"hostname:s" => { name => 'hostname' },
"port:s" => { name => 'port', default => '80' },
"port:s" => { name => 'port', },
"proto:s" => { name => 'proto', default => "http" },
"urlpath:s" => { name => 'url_path', default => "/server-status/?auto" },
"credentials" => { name => 'credentials' },

View File

@ -46,8 +46,13 @@ sub connect {
my $connection_exit = defined($options{connection_exit}) ? $options{connection_exit} : 'unknown';
my ($response, $content);
my $req;
my $req = HTTP::Request->new( GET => $self->{option_results}->{proto}. "://" . $self->{option_results}->{hostname}.':'. $self->{option_results}->{port} . $self->{option_results}->{url_path});
if (defined($self->{option_results}->{port})) {
$req = HTTP::Request->new( GET => $self->{option_results}->{proto}. "://" . $self->{option_results}->{hostname}.':'. $self->{option_results}->{port} . $self->{option_results}->{url_path});
} else {
$req = HTTP::Request->new( GET => $self->{option_results}->{proto}. "://" . $self->{option_results}->{hostname} . $self->{option_results}->{url_path});
}
if (defined($self->{option_results}->{credentials})) {
$req->authorization_basic($self->{option_results}->{username}, $self->{option_results}->{password});