summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--NEWS1
-rw-r--r--THANKS.in2
-rw-r--r--plugins/check_http.c18
3 files changed, 19 insertions, 2 deletions
diff --git a/NEWS b/NEWS
index e6df5797..82315482 100644
--- a/NEWS
+++ b/NEWS
@@ -2,6 +2,7 @@ This file documents the major additions and syntax changes between releases.
2 2
31.4.15 ... 31.4.15 ...
4 Fix check_ircd binding to wrong interface (#668778) 4 Fix check_ircd binding to wrong interface (#668778)
5 Add proxy-authorization option to check_http (Peter Doherty - #2863772, Bryan Irvine - #2863925)
5 6
61.4.14 16th September 2009 71.4.14 16th September 2009
7 check_http has options to specify the HTTP method (#2155152) 8 check_http has options to specify the HTTP method (#2155152)
diff --git a/THANKS.in b/THANKS.in
index 038ad935..85ad0414 100644
--- a/THANKS.in
+++ b/THANKS.in
@@ -256,3 +256,5 @@ Joe Presbrey
256Will Preston 256Will Preston
257Nikita Kalabukhov 257Nikita Kalabukhov
258Grant Byers 258Grant Byers
259Peter Doherty
260Bryan Irvine
diff --git a/plugins/check_http.c b/plugins/check_http.c
index 79f6adf3..b4e60041 100644
--- a/plugins/check_http.c
+++ b/plugins/check_http.c
@@ -105,6 +105,7 @@ int check_warning_time = FALSE;
105double critical_time = 0; 105double critical_time = 0;
106int check_critical_time = FALSE; 106int check_critical_time = FALSE;
107char user_auth[MAX_INPUT_BUFFER] = ""; 107char user_auth[MAX_INPUT_BUFFER] = "";
108char proxy_auth[MAX_INPUT_BUFFER] = "";
108int display_html = FALSE; 109int display_html = FALSE;
109char **http_opt_headers; 110char **http_opt_headers;
110int http_opt_headers_count = 0; 111int http_opt_headers_count = 0;
@@ -192,6 +193,7 @@ process_arguments (int argc, char **argv)
192 {"url", required_argument, 0, 'u'}, 193 {"url", required_argument, 0, 'u'},
193 {"port", required_argument, 0, 'p'}, 194 {"port", required_argument, 0, 'p'},
194 {"authorization", required_argument, 0, 'a'}, 195 {"authorization", required_argument, 0, 'a'},
196 {"proxy_authorization", required_argument, 0, 'b'},
195 {"string", required_argument, 0, 's'}, 197 {"string", required_argument, 0, 's'},
196 {"expect", required_argument, 0, 'e'}, 198 {"expect", required_argument, 0, 'e'},
197 {"regex", required_argument, 0, 'r'}, 199 {"regex", required_argument, 0, 'r'},
@@ -229,7 +231,7 @@ process_arguments (int argc, char **argv)
229 } 231 }
230 232
231 while (1) { 233 while (1) {
232 c = getopt_long (argc, argv, "Vvh46t:c:w:A:k:H:P:j:T:I:a:e:p:s:R:r:u:f:C:nlLSm:M:N", longopts, &option); 234 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);
233 if (c == -1 || c == EOF) 235 if (c == -1 || c == EOF)
234 break; 236 break;
235 237
@@ -350,6 +352,10 @@ process_arguments (int argc, char **argv)
350 strncpy (user_auth, optarg, MAX_INPUT_BUFFER - 1); 352 strncpy (user_auth, optarg, MAX_INPUT_BUFFER - 1);
351 user_auth[MAX_INPUT_BUFFER - 1] = 0; 353 user_auth[MAX_INPUT_BUFFER - 1] = 0;
352 break; 354 break;
355 case 'b': /* proxy-authorization info */
356 strncpy (proxy_auth, optarg, MAX_INPUT_BUFFER - 1);
357 proxy_auth[MAX_INPUT_BUFFER - 1] = 0;
358 break;
353 case 'P': /* HTTP POST data in URL encoded format; ignored if settings already */ 359 case 'P': /* HTTP POST data in URL encoded format; ignored if settings already */
354 if (! http_post_data) 360 if (! http_post_data)
355 http_post_data = strdup (optarg); 361 http_post_data = strdup (optarg);
@@ -836,6 +842,12 @@ check_http (void)
836 asprintf (&buf, "%sAuthorization: Basic %s\r\n", buf, auth); 842 asprintf (&buf, "%sAuthorization: Basic %s\r\n", buf, auth);
837 } 843 }
838 844
845 /* optionally send the proxy authentication info */
846 if (strlen(proxy_auth)) {
847 base64_encode_alloc (proxy_auth, strlen (proxy_auth), &auth);
848 asprintf (&buf, "%sProxy-Authorization: Basic %s\r\n", buf, auth);
849 }
850
839 /* either send http POST data (any data, not only POST)*/ 851 /* either send http POST data (any data, not only POST)*/
840 if (http_post_data) { 852 if (http_post_data) {
841 if (http_content_type) { 853 if (http_content_type) {
@@ -1346,6 +1358,8 @@ print_help (void)
1346 1358
1347 printf (" %s\n", "-a, --authorization=AUTH_PAIR"); 1359 printf (" %s\n", "-a, --authorization=AUTH_PAIR");
1348 printf (" %s\n", _("Username:password on sites with basic authentication")); 1360 printf (" %s\n", _("Username:password on sites with basic authentication"));
1361 printf (" %s\n", "-b, --proxy-authorization=AUTH_PAIR");
1362 printf (" %s\n", _("Username:password on proxy-servers with basic authentication"));
1349 printf (" %s\n", "-A, --useragent=STRING"); 1363 printf (" %s\n", "-A, --useragent=STRING");
1350 printf (" %s\n", _("String to be sent in http header as \"User Agent\"")); 1364 printf (" %s\n", _("String to be sent in http header as \"User Agent\""));
1351 printf (" %s\n", "-k, --header=STRING"); 1365 printf (" %s\n", "-k, --header=STRING");
@@ -1407,7 +1421,7 @@ print_usage (void)
1407 printf (_("Usage:")); 1421 printf (_("Usage:"));
1408 printf (" %s -H <vhost> | -I <IP-address> [-u <uri>] [-p <port>]\n",progname); 1422 printf (" %s -H <vhost> | -I <IP-address> [-u <uri>] [-p <port>]\n",progname);
1409 printf (" [-w <warn time>] [-c <critical time>] [-t <timeout>] [-L]\n"); 1423 printf (" [-w <warn time>] [-c <critical time>] [-t <timeout>] [-L]\n");
1410 printf (" [-a auth] [-f <ok | warn | critcal | follow | sticky | stickyport>]\n"); 1424 printf (" [-a auth] [-b proxy_auth] [-f <ok | warn | critcal | follow | sticky | stickyport>]\n");
1411 printf (" [-e <expect>] [-s string] [-l] [-r <regex> | -R <case-insensitive regex>]\n"); 1425 printf (" [-e <expect>] [-s string] [-l] [-r <regex> | -R <case-insensitive regex>]\n");
1412 printf (" [-P string] [-m <min_pg_size>:<max_pg_size>] [-4|-6] [-N] [-M <age>]\n"); 1426 printf (" [-P string] [-m <min_pg_size>:<max_pg_size>] [-4|-6] [-N] [-M <age>]\n");
1413 printf (" [-A string] [-k string] [-S] [-C <age>] [-T <content-type>] [-j method]\n"); 1427 printf (" [-A string] [-k string] [-S] [-C <age>] [-T <content-type>] [-j method]\n");