summaryrefslogtreecommitdiffstats
path: root/plugins
diff options
context:
space:
mode:
authorThomas Guyot-Sionnest <dermoth@aei.ca>2009-02-05 05:08:54 (GMT)
committerThomas Guyot-Sionnest <dermoth@aei.ca>2009-02-05 05:47:07 (GMT)
commitd00a53dd1e4b818f36dd8ef0ee9245445b0ee8e9 (patch)
tree0f048546c9faedf89285d35e494237821d35e978 /plugins
parent8aa65b21eb06492a3c6af3b14de3122ab96c7254 (diff)
downloadmonitoring-plugins-d00a53dd1e4b818f36dd8ef0ee9245445b0ee8e9.tar.gz
check_http --onredirect=sticky follows using the same IP address (sf.net #2550208).
Diffstat (limited to 'plugins')
-rw-r--r--plugins/check_http.c16
1 files changed, 11 insertions, 5 deletions
diff --git a/plugins/check_http.c b/plugins/check_http.c
index 933e9d4..620e157 100644
--- a/plugins/check_http.c
+++ b/plugins/check_http.c
@@ -106,6 +106,7 @@ int display_html = FALSE;
106char **http_opt_headers; 106char **http_opt_headers;
107int http_opt_headers_count = 0; 107int http_opt_headers_count = 0;
108int onredirect = STATE_OK; 108int onredirect = STATE_OK;
109int followsticky = 0;
109int use_ssl = FALSE; 110int use_ssl = FALSE;
110int verbose = FALSE; 111int verbose = FALSE;
111int sd; 112int sd;
@@ -299,8 +300,10 @@ process_arguments (int argc, char **argv)
299 server_port = HTTPS_PORT; 300 server_port = HTTPS_PORT;
300 break; 301 break;
301 case 'f': /* onredirect */ 302 case 'f': /* onredirect */
303 if (!strcmp (optarg, "sticky"))
304 onredirect = STATE_DEPENDENT, followsticky = 1;
302 if (!strcmp (optarg, "follow")) 305 if (!strcmp (optarg, "follow"))
303 onredirect = STATE_DEPENDENT; 306 onredirect = STATE_DEPENDENT, followsticky = 0;
304 if (!strcmp (optarg, "unknown")) 307 if (!strcmp (optarg, "unknown"))
305 onredirect = STATE_UNKNOWN; 308 onredirect = STATE_UNKNOWN;
306 if (!strcmp (optarg, "ok")) 309 if (!strcmp (optarg, "ok"))
@@ -1200,8 +1203,10 @@ redir (char *pos, char *status_line)
1200 free (host_name); 1203 free (host_name);
1201 host_name = strdup (addr); 1204 host_name = strdup (addr);
1202 1205
1203 free (server_address); 1206 if (followsticky == 0) {
1204 server_address = strdup (addr); 1207 free (server_address);
1208 server_address = strdup (addr);
1209 }
1205 1210
1206 free (server_url); 1211 free (server_url);
1207 server_url = url; 1212 server_url = url;
@@ -1338,8 +1343,9 @@ print_help (void)
1338 printf (" %s\n", _(" Any other tags to be sent in http header. Use multiple times for additional headers")); 1343 printf (" %s\n", _(" Any other tags to be sent in http header. Use multiple times for additional headers"));
1339 printf (" %s\n", "-L, --link"); 1344 printf (" %s\n", "-L, --link");
1340 printf (" %s\n", _("Wrap output in HTML link (obsoleted by urlize)")); 1345 printf (" %s\n", _("Wrap output in HTML link (obsoleted by urlize)"));
1341 printf (" %s\n", "-f, --onredirect=<ok|warning|critical|follow>"); 1346 printf (" %s\n", "-f, --onredirect=<ok|warning|critical|follow|sticky>");
1342 printf (" %s\n", _("How to handle redirected pages")); 1347 printf (" %s\n", _("How to handle redirected pages. sticky is like follow but stick to the"));
1348 printf (" %s\n", _("specified IP address"));
1343 printf (" %s\n", "-m, --pagesize=INTEGER<:INTEGER>"); 1349 printf (" %s\n", "-m, --pagesize=INTEGER<:INTEGER>");
1344 printf (" %s\n", _("Minimum page size required (bytes) : Maximum page size required (bytes)")); 1350 printf (" %s\n", _("Minimum page size required (bytes) : Maximum page size required (bytes)"));
1345 1351