aboutsummaryrefslogtreecommitdiff
path: root/plugins/check_http.c
diff options
context:
space:
mode:
authorGravatar Holger Weiss <hweiss@users.sourceforge.net> 2008-01-07 01:59:59 +0000
committerGravatar Holger Weiss <hweiss@users.sourceforge.net> 2008-01-07 01:59:59 +0000
commit59a2d41d63e3dd766ee9c8fcd6d086d88f6ac417 (patch)
tree6ea9697b0ca92b590bd8e6072713e658692d678e /plugins/check_http.c
parent6157a19b1b955e44599d578be157085c137ffc5a (diff)
downloadmonitoring-plugins-59a2d41d63e3dd766ee9c8fcd6d086d88f6ac417.tar.gz
My assumption that "-H example.com:80" didn't work (see my previous
commit) was wrong, it worked if used together with "-I". So, here's support for "-H [IPv6]:port", "-H [IPv6]", "-H IPv6", "-H IPv4:port", "-H IPv4", and "-H host:port". git-svn-id: https://nagiosplug.svn.sourceforge.net/svnroot/nagiosplug/nagiosplug/trunk@1892 f882894a-f735-0410-b71e-b25c423dba1c
Diffstat (limited to 'plugins/check_http.c')
-rw-r--r--plugins/check_http.c7
1 files changed, 7 insertions, 0 deletions
diff --git a/plugins/check_http.c b/plugins/check_http.c
index 9fb7aea4..3530e71a 100644
--- a/plugins/check_http.c
+++ b/plugins/check_http.c
@@ -174,6 +174,7 @@ int
process_arguments (int argc, char **argv)
{
int c = 1;
+ char *p;
enum {
INVERT_REGEX = CHAR_MAX + 1
@@ -317,6 +318,12 @@ process_arguments (int argc, char **argv)
/* Note: H, I, and u must be malloc'd or will fail on redirects */
case 'H': /* Host Name (virtual host) */
host_name = strdup (optarg);
+ if (host_name[0] == '[') {
+ if ((p = strstr (host_name, "]:")) != NULL) /* [IPv6]:port */
+ server_port = atoi (p + 2);
+ } else if ((p = strchr (host_name, ':')) != NULL
+ && strchr (++p, ':') == NULL) /* IPv4:port or host:port */
+ server_port = atoi (p);
break;
case 'I': /* Server IP-address */
server_address = strdup (optarg);