summaryrefslogtreecommitdiffstats
path: root/web/attachments/432136-check_http.patch
diff options
context:
space:
mode:
Diffstat (limited to 'web/attachments/432136-check_http.patch')
-rw-r--r--web/attachments/432136-check_http.patch77
1 files changed, 77 insertions, 0 deletions
diff --git a/web/attachments/432136-check_http.patch b/web/attachments/432136-check_http.patch
new file mode 100644
index 0000000..827bfba
--- /dev/null
+++ b/web/attachments/432136-check_http.patch
@@ -0,0 +1,77 @@
1--- check_http.c.old 2010-07-27 12:47:16.000000000 -0700
2+++ check_http.c 2012-01-03 16:43:56.000000000 -0800
3@@ -99,7 +99,9 @@
4 int server_url_length;
5 int server_expect_yn = 0;
6 char server_expect[MAX_INPUT_BUFFER] = HTTP_EXPECT;
7+char header_expect[MAX_INPUT_BUFFER] = "";
8 char string_expect[MAX_INPUT_BUFFER] = "";
9+char output_header_search[30] = "";
10 char output_string_search[30] = "";
11 double warning_time = 0;
12 int check_warning_time = FALSE;
13@@ -198,6 +200,7 @@
14 {"port", required_argument, 0, 'p'},
15 {"authorization", required_argument, 0, 'a'},
16 {"proxy_authorization", required_argument, 0, 'b'},
17+ {"return_header", required_argument, 0, 'd'},
18 {"string", required_argument, 0, 's'},
19 {"expect", required_argument, 0, 'e'},
20 {"regex", required_argument, 0, 'r'},
21@@ -235,7 +238,7 @@
22 }
23
24 while (1) {
25- c = getopt_long (argc, argv, "Vvh46t:c:w:A:k:H:P:j:T:I:a:b:e:p:s:R:r:u:f:C:nlLSm:M:N", longopts, &option);
26+ c = getopt_long (argc, argv, "Vvh46t:c:w:A:k:H:P:j:T:I:a:b:d:e:p:s:R:r:u:f:C:nlLSm:M:N", longopts, &option);
27 if (c == -1 || c == EOF)
28 break;
29
30@@ -374,6 +377,10 @@
31 free(http_method);
32 http_method = strdup (optarg);
33 break;
34+ case 'd': /* string or substring */
35+ strncpy (header_expect, optarg, MAX_INPUT_BUFFER - 1);
36+ header_expect[MAX_INPUT_BUFFER - 1] = 0;
37+ break;
38 case 's': /* string or substring */
39 strncpy (string_expect, optarg, MAX_INPUT_BUFFER - 1);
40 string_expect[MAX_INPUT_BUFFER - 1] = 0;
41@@ -1036,6 +1043,18 @@
42
43 /* Page and Header content checks go here */
44
45+ if (strlen (header_expect)) {
46+ if (!strstr (header, header_expect)) {
47+ strncpy(&output_header_search[0],header_expect,sizeof(output_header_search));
48+ if(output_header_search[sizeof(output_header_search)-1]!='\0') {
49+ bcopy("...",&output_header_search[sizeof(output_header_search)-4],4);
50+ }
51+ asprintf (&msg, _("%sheader '%s' not found on '%s://%s:%d%s', "), msg, output_header_search, use_ssl ? "https" : "http", host_name ? host_name : server_address, server_port, server_url);
52+ result = STATE_CRITICAL;
53+ }
54+ }
55+
56+
57 if (strlen (string_expect)) {
58 if (!strstr (page, string_expect)) {
59 strncpy(&output_string_search[0],string_expect,sizeof(output_string_search));
60@@ -1368,6 +1387,8 @@
61
62 printf (" %s\n", "-l, --linespan");
63 printf (" %s\n", _("Allow regex to span newlines (must precede -r or -R)"));
64+ printf (" %s\n", "-d, --header-string=STRING");
65+ printf (" %s\n", _("Search header for regex STRING"));
66 printf (" %s\n", "-r, --regex, --ereg=STRING");
67 printf (" %s\n", _("Search page for regex STRING"));
68 printf (" %s\n", "-R, --eregi=STRING");
69@@ -1438,7 +1459,7 @@
70 printf ("%s\n", _("Usage:"));
71 printf (" %s -H <vhost> | -I <IP-address> [-u <uri>] [-p <port>]\n",progname);
72 printf (" [-w <warn time>] [-c <critical time>] [-t <timeout>] [-L] [-a auth]\n");
73- printf (" [-b proxy_auth] [-f <ok|warning|critcal|follow|sticky|stickyport>]\n");
74+ printf (" [-b proxy_auth] [-d string] [-f <ok|warning|critcal|follow|sticky|stickyport>]\n");
75 printf (" [-e <expect>] [-s string] [-l] [-r <regex> | -R <case-insensitive regex>]\n");
76 printf (" [-P string] [-m <min_pg_size>:<max_pg_size>] [-4|-6] [-N] [-M <age>]\n");
77 printf (" [-A string] [-k string] [-S] [--sni] [-C <age>] [-T <content-type>]\n");