diff options
Diffstat (limited to 'plugins')
-rw-r--r-- | plugins/check_http.c | 7 |
1 files changed, 7 insertions, 0 deletions
diff --git a/plugins/check_http.c b/plugins/check_http.c index 9fb7aea..3530e71 100644 --- a/plugins/check_http.c +++ b/plugins/check_http.c | |||
@@ -174,6 +174,7 @@ int | |||
174 | process_arguments (int argc, char **argv) | 174 | process_arguments (int argc, char **argv) |
175 | { | 175 | { |
176 | int c = 1; | 176 | int c = 1; |
177 | char *p; | ||
177 | 178 | ||
178 | enum { | 179 | enum { |
179 | INVERT_REGEX = CHAR_MAX + 1 | 180 | INVERT_REGEX = CHAR_MAX + 1 |
@@ -317,6 +318,12 @@ process_arguments (int argc, char **argv) | |||
317 | /* Note: H, I, and u must be malloc'd or will fail on redirects */ | 318 | /* Note: H, I, and u must be malloc'd or will fail on redirects */ |
318 | case 'H': /* Host Name (virtual host) */ | 319 | case 'H': /* Host Name (virtual host) */ |
319 | host_name = strdup (optarg); | 320 | host_name = strdup (optarg); |
321 | if (host_name[0] == '[') { | ||
322 | if ((p = strstr (host_name, "]:")) != NULL) /* [IPv6]:port */ | ||
323 | server_port = atoi (p + 2); | ||
324 | } else if ((p = strchr (host_name, ':')) != NULL | ||
325 | && strchr (++p, ':') == NULL) /* IPv4:port or host:port */ | ||
326 | server_port = atoi (p); | ||
320 | break; | 327 | break; |
321 | case 'I': /* Server IP-address */ | 328 | case 'I': /* Server IP-address */ |
322 | server_address = strdup (optarg); | 329 | server_address = strdup (optarg); |