[Nagiosplug-checkins] SF.net SVN: nagiosplug: [1892] nagiosplug/trunk/plugins/check_http.c
hweiss at users.sourceforge.net
hweiss at users.sourceforge.net
Mon Jan 7 02:59:59 CET 2008
Revision: 1892
http://nagiosplug.svn.sourceforge.net/nagiosplug/?rev=1892&view=rev
Author: hweiss
Date: 2008-01-06 17:59:59 -0800 (Sun, 06 Jan 2008)
Log Message:
-----------
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".
Modified Paths:
--------------
nagiosplug/trunk/plugins/check_http.c
Modified: nagiosplug/trunk/plugins/check_http.c
===================================================================
--- nagiosplug/trunk/plugins/check_http.c 2008-01-06 19:45:00 UTC (rev 1891)
+++ nagiosplug/trunk/plugins/check_http.c 2008-01-07 01:59:59 UTC (rev 1892)
@@ -174,6 +174,7 @@
process_arguments (int argc, char **argv)
{
int c = 1;
+ char *p;
enum {
INVERT_REGEX = CHAR_MAX + 1
@@ -317,6 +318,12 @@
/* 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);
This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.
More information about the Commits
mailing list