diff options
author | Greg Cox <gcox@fibbsbozza.local> | 2014-07-29 22:52:12 (GMT) |
---|---|---|
committer | Greg Cox <gcox@fibbsbozza.local> | 2014-07-29 22:52:12 (GMT) |
commit | 4273dd06ff3e52094d6b267d00e8c51dd74de364 (patch) | |
tree | 425d127da5dbec7013999ed01b469fc3f72992d9 /plugins/check_http.c | |
parent | f05e7016320f4671fbf86cc5abc277efea20f79e (diff) | |
parent | 6f3d5825b203b75aef8d68bf0d117e7a1a4c0616 (diff) | |
download | monitoring-plugins-4273dd06ff3e52094d6b267d00e8c51dd74de364.tar.gz |
Merge remote-tracking branch 'upstream/master'refs/pull/1257/head
Conflicts:
plugins/netutils.c
Diffstat (limited to 'plugins/check_http.c')
-rw-r--r-- | plugins/check_http.c | 10 |
1 files changed, 6 insertions, 4 deletions
diff --git a/plugins/check_http.c b/plugins/check_http.c index 92861d9..5167997 100644 --- a/plugins/check_http.c +++ b/plugins/check_http.c | |||
@@ -1243,6 +1243,7 @@ redir (char *pos, char *status_line) | |||
1243 | if (addr == NULL) | 1243 | if (addr == NULL) |
1244 | die (STATE_UNKNOWN, _("HTTP UNKNOWN - Could not allocate addr\n")); | 1244 | die (STATE_UNKNOWN, _("HTTP UNKNOWN - Could not allocate addr\n")); |
1245 | 1245 | ||
1246 | memset(addr, 0, MAX_IPV4_HOSTLENGTH); | ||
1246 | url = malloc (strcspn (pos, "\r\n")); | 1247 | url = malloc (strcspn (pos, "\r\n")); |
1247 | if (url == NULL) | 1248 | if (url == NULL) |
1248 | die (STATE_UNKNOWN, _("HTTP UNKNOWN - Could not allocate URL\n")); | 1249 | die (STATE_UNKNOWN, _("HTTP UNKNOWN - Could not allocate URL\n")); |
@@ -1333,8 +1334,8 @@ redir (char *pos, char *status_line) | |||
1333 | max_depth, type, addr, i, url, (display_html ? "</A>" : "")); | 1334 | max_depth, type, addr, i, url, (display_html ? "</A>" : "")); |
1334 | 1335 | ||
1335 | if (server_port==i && | 1336 | if (server_port==i && |
1336 | !strcmp(server_address, addr) && | 1337 | !strncmp(server_address, addr, MAX_IPV4_HOSTLENGTH) && |
1337 | (host_name && !strcmp(host_name, addr)) && | 1338 | (host_name && !strncmp(host_name, addr, MAX_IPV4_HOSTLENGTH)) && |
1338 | !strcmp(server_url, url)) | 1339 | !strcmp(server_url, url)) |
1339 | die (STATE_WARNING, | 1340 | die (STATE_WARNING, |
1340 | _("HTTP WARNING - redirection creates an infinite loop - %s://%s:%d%s%s\n"), | 1341 | _("HTTP WARNING - redirection creates an infinite loop - %s://%s:%d%s%s\n"), |
@@ -1343,11 +1344,11 @@ redir (char *pos, char *status_line) | |||
1343 | strcpy (server_type, type); | 1344 | strcpy (server_type, type); |
1344 | 1345 | ||
1345 | free (host_name); | 1346 | free (host_name); |
1346 | host_name = strdup (addr); | 1347 | host_name = strndup (addr, MAX_IPV4_HOSTLENGTH); |
1347 | 1348 | ||
1348 | if (!(followsticky & STICKY_HOST)) { | 1349 | if (!(followsticky & STICKY_HOST)) { |
1349 | free (server_address); | 1350 | free (server_address); |
1350 | server_address = strdup (addr); | 1351 | server_address = strndup (addr, MAX_IPV4_HOSTLENGTH); |
1351 | } | 1352 | } |
1352 | if (!(followsticky & STICKY_PORT)) { | 1353 | if (!(followsticky & STICKY_PORT)) { |
1353 | server_port = i; | 1354 | server_port = i; |
@@ -1366,6 +1367,7 @@ redir (char *pos, char *status_line) | |||
1366 | printf (_("Redirection to %s://%s:%d%s\n"), server_type, | 1367 | printf (_("Redirection to %s://%s:%d%s\n"), server_type, |
1367 | host_name ? host_name : server_address, server_port, server_url); | 1368 | host_name ? host_name : server_address, server_port, server_url); |
1368 | 1369 | ||
1370 | free(addr); | ||
1369 | check_http (); | 1371 | check_http (); |
1370 | } | 1372 | } |
1371 | 1373 | ||