diff --git a/plugins/check_http.c b/plugins/check_http.c
index 933e9d4fc72c43359efc12bc8e8d1cdc012fdb0b..248c0f94d3b652c27c3b38f0c366c99a500a4aeb 100644 (file)
--- a/plugins/check_http.c
+++ b/plugins/check_http.c
char **http_opt_headers;
int http_opt_headers_count = 0;
int onredirect = STATE_OK;
+int followsticky = 0;
int use_ssl = FALSE;
int verbose = FALSE;
int sd;
server_port = HTTPS_PORT;
break;
case 'f': /* onredirect */
+ if (!strcmp (optarg, "sticky"))
+ onredirect = STATE_DEPENDENT, followsticky = 1;
if (!strcmp (optarg, "follow"))
- onredirect = STATE_DEPENDENT;
+ onredirect = STATE_DEPENDENT, followsticky = 0;
if (!strcmp (optarg, "unknown"))
onredirect = STATE_UNKNOWN;
if (!strcmp (optarg, "ok"))
}
/* server errors result in a critical state */
else if (http_status >= 500) {
- asprintf (&msg, _("%s - "), msg, status_line);
+ asprintf (&msg, _("%s - "), status_line);
result = STATE_CRITICAL;
}
/* client errors result in a warning state */
/* check elapsed time */
asprintf (&msg,
- _("%s - %.3f second response time %s|%s %s"),
- msg, elapsed_time,
+ _("%s - %d bytes in %.3f second response time %s|%s %s"),
+ msg, page_len, elapsed_time,
(display_html ? "</A>" : ""),
perfd_time (elapsed_time), perfd_size (page_len));
url = malloc (strcspn (pos, "\r\n"));
if (url == NULL)
- die (STATE_UNKNOWN, _("HTTP UNKNOWN - Could not allocate url\n"));
+ die (STATE_UNKNOWN, _("HTTP UNKNOWN - Could not allocate URL\n"));
while (pos) {
sscanf (pos, "%1[Ll]%*1[Oo]%*1[Cc]%*1[Aa]%*1[Tt]%*1[Ii]%*1[Oo]%*1[Nn]:%n", xx, &i);
url = realloc (url, strcspn (pos, "\r\n") + 1);
if (url == NULL)
- die (STATE_UNKNOWN, _("HTTP UNKNOWN - could not allocate url\n"));
+ die (STATE_UNKNOWN, _("HTTP UNKNOWN - Could not allocate URL\n"));
/* URI_HTTP, URI_HOST, URI_PORT, URI_PATH */
if (sscanf (pos, HD1, type, addr, &i, url) == 4) {
free (host_name);
host_name = strdup (addr);
- free (server_address);
- server_address = strdup (addr);
+ if (followsticky == 0) {
+ free (server_address);
+ server_address = strdup (addr);
+ }
free (server_url);
server_url = url;
printf (" %s\n", _("Connect via SSL. Port defaults to 443"));
printf (" %s\n", "-C, --certificate=INTEGER");
printf (" %s\n", _("Minimum number of days a certificate has to be valid. Port defaults to 443"));
- printf (" %s\n", _("(when this option is used the url is not checked.)\n"));
+ printf (" %s\n", _("(when this option is used the URL is not checked.)\n"));
#endif
printf (" %s\n", "-e, --expect=STRING");
printf (" %s\n", _(" Any other tags to be sent in http header. Use multiple times for additional headers"));
printf (" %s\n", "-L, --link");
printf (" %s\n", _("Wrap output in HTML link (obsoleted by urlize)"));
- printf (" %s\n", "-f, --onredirect=<ok|warning|critical|follow>");
- printf (" %s\n", _("How to handle redirected pages"));
+ printf (" %s\n", "-f, --onredirect=<ok|warning|critical|follow|sticky>");
+ printf (" %s\n", _("How to handle redirected pages. sticky is like follow but stick to the"));
+ printf (" %s\n", _("specified IP address"));
printf (" %s\n", "-m, --pagesize=INTEGER<:INTEGER>");
printf (" %s\n", _("Minimum page size required (bytes) : Maximum page size required (bytes)"));