aboutsummaryrefslogtreecommitdiff
path: root/plugins/check_http.c
diff options
context:
space:
mode:
Diffstat (limited to 'plugins/check_http.c')
-rw-r--r--plugins/check_http.c29
1 files changed, 25 insertions, 4 deletions
diff --git a/plugins/check_http.c b/plugins/check_http.c
index de59a068..34fb4f01 100644
--- a/plugins/check_http.c
+++ b/plugins/check_http.c
@@ -72,7 +72,7 @@ int maximum_age = -1;
enum {
REGS = 2,
- MAX_RE_SIZE = 256
+ MAX_RE_SIZE = 1024
};
#include "regex.h"
regex_t preg;
@@ -931,6 +931,21 @@ check_http (void)
if (verbose) printf ("Entering CONNECT tunnel mode with proxy %s:%d to dst %s:%d\n", server_address, server_port, host_name, HTTPS_PORT);
asprintf (&buf, "%s %s:%d HTTP/1.1\r\n%s\r\n", http_method, host_name, HTTPS_PORT, user_agent);
+ if (strlen(proxy_auth)) {
+ base64_encode_alloc (proxy_auth, strlen (proxy_auth), &auth);
+ xasprintf (&buf, "%sProxy-Authorization: Basic %s\r\n", buf, auth);
+ }
+ /* optionally send any other header tag */
+ if (http_opt_headers_count) {
+ for (i = 0; i < http_opt_headers_count ; i++) {
+ if (force_host_header != http_opt_headers[i]) {
+ xasprintf (&buf, "%s%s\r\n", buf, http_opt_headers[i]);
+ }
+ }
+ /* This cannot be free'd here because a redirection will then try to access this and segfault */
+ /* Covered in a testcase in tests/check_http.t */
+ /* free(http_opt_headers); */
+ }
asprintf (&buf, "%sProxy-Connection: keep-alive\r\n", buf);
asprintf (&buf, "%sHost: %s\r\n", buf, host_name);
/* we finished our request, send empty line with CRLF */
@@ -1438,8 +1453,8 @@ redir (char *pos, char *status_line)
!strncmp(server_address, addr, MAX_IPV4_HOSTLENGTH) &&
(host_name && !strncmp(host_name, addr, MAX_IPV4_HOSTLENGTH)) &&
!strcmp(server_url, url))
- die (STATE_WARNING,
- _("HTTP WARNING - redirection creates an infinite loop - %s://%s:%d%s%s\n"),
+ die (STATE_CRITICAL,
+ _("HTTP CRITICAL - redirection creates an infinite loop - %s://%s:%d%s%s\n"),
type, addr, i, url, (display_html ? "</A>" : ""));
strcpy (server_type, type);
@@ -1552,6 +1567,10 @@ print_help (void)
print_usage ();
+#ifdef HAVE_SSL
+ printf (_("In the first form, make an HTTP request."));
+ printf (_("In the second form, connect to the server and check the TLS certificate."));
+#endif
printf (_("NOTE: One or both of -H and -I must be specified"));
printf ("\n");
@@ -1711,6 +1730,8 @@ print_usage (void)
printf (" [-b proxy_auth] [-f <ok|warning|critcal|follow|sticky|stickyport>]\n");
printf (" [-e <expect>] [-d string] [-s string] [-l] [-r <regex> | -R <case-insensitive regex>]\n");
printf (" [-P string] [-m <min_pg_size>:<max_pg_size>] [-4|-6] [-N] [-M <age>]\n");
- printf (" [-A string] [-k string] [-S <version>] [--sni] [-C <warn_age>[,<crit_age>]]\n");
+ printf (" [-A string] [-k string] [-S <version>] [--sni]\n");
printf (" [-T <content-type>] [-j method]\n");
+ printf (" %s -H <vhost> | -I <IP-address> -C <warn_age>[,<crit_age>]\n",progname);
+ printf (" [-p <port>] [-t <timeout>] [-4|-6] [--sni]\n");
}