summary | shortlog | log | commit | commitdiff | tree
raw | patch | inline | side by side (parent: 6157a19)
raw | patch | inline | side by side (parent: 6157a19)
author | Holger Weiss <hweiss@users.sourceforge.net> | |
Mon, 7 Jan 2008 01:59:59 +0000 (01:59 +0000) | ||
committer | Holger Weiss <hweiss@users.sourceforge.net> | |
Mon, 7 Jan 2008 01:59:59 +0000 (01:59 +0000) |
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
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
plugins/check_http.c | patch | blob | history |
diff --git a/plugins/check_http.c b/plugins/check_http.c
index 9fb7aea40d6a9d9735c5a53336dc07a846e0f1d0..3530e71a05947c9f3aca424ea2aae1af50522549 100644 (file)
--- a/plugins/check_http.c
+++ b/plugins/check_http.c
process_arguments (int argc, char **argv)
{
int c = 1;
+ char *p;
enum {
INVERT_REGEX = CHAR_MAX + 1
/* 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);