blob: 336b542427543a303c340bf64b07818a1b0c06db (
plain)
| 1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
 | --- a/check_httpd_status/check_httpd_status
+++ b/check_httpd_status/check_httpd_status
@@ -213,7 +213,13 @@
 logD("Web URL : $url");
 
 my $req = HTTP::Request->new( GET => $url );
-if ( defined($o_user) ) {
+if ( defined($o_realm) ) {
+    if ( ! defined($o_port) ) {
+        $o_port = 80;
+    }
+    $ua->credentials("$o_host:$o_port", $o_realm, $o_user, $o_pass);
+}
+elsif ( defined($o_user) ) {
 	$req->authorization_basic($o_user, $o_pass);
 }
 
 |