mirror of
https://github.com/monitoring-plugins/monitoring-plugins.git
synced 2026-07-16 22:37:50 -04:00
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
This commit is contained in:
parent
6157a19b1b
commit
59a2d41d63
1 changed files with 7 additions and 0 deletions
|
|
@ -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);
|
||||
|
|
|
|||
Loading…
Reference in a new issue