summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--plugins/check_curl.c21
1 files changed, 16 insertions, 5 deletions
diff --git a/plugins/check_curl.c b/plugins/check_curl.c
index 6b33d1c..96b5a5e 100644
--- a/plugins/check_curl.c
+++ b/plugins/check_curl.c
@@ -130,6 +130,7 @@ char *client_cert = NULL;
130char *client_privkey = NULL; 130char *client_privkey = NULL;
131char *ca_cert = NULL; 131char *ca_cert = NULL;
132X509 *cert = NULL; 132X509 *cert = NULL;
133int no_body = FALSE;
133 134
134int process_arguments (int, char**); 135int process_arguments (int, char**);
135int check_http (void); 136int check_http (void);
@@ -324,6 +325,10 @@ check_http (void)
324 */ 325 */
325 } 326 }
326 327
328 /* no-body */
329 if (no_body)
330 curl_easy_setopt (curl, CURLOPT_NOBODY, 1);
331
327 /* do the request */ 332 /* do the request */
328 res = curl_easy_perform(curl); 333 res = curl_easy_perform(curl);
329 334
@@ -395,10 +400,8 @@ check_http (void)
395 400
396 /* print status line, header, body if verbose */ 401 /* print status line, header, body if verbose */
397 if (verbose >= 2) { 402 if (verbose >= 2) {
398 puts ("--- HEADER ---"); 403 printf ("**** HEADER ****\n%s\n**** CONTENT ****\n%s\n", header_buf.buf,
399 puts (header_buf.buf); 404 (no_body ? " [[ skipped ]]" : body_buf.buf));
400 puts ("--- BODY ---");
401 puts (body_buf.buf);
402 } 405 }
403 406
404 /* illegal return codes result in a critical state */ 407 /* illegal return codes result in a critical state */
@@ -524,6 +527,7 @@ process_arguments (int argc, char **argv)
524 {"ca-cert", required_argument, 0, CA_CERT_OPTION}, 527 {"ca-cert", required_argument, 0, CA_CERT_OPTION},
525 {"useragent", required_argument, 0, 'A'}, 528 {"useragent", required_argument, 0, 'A'},
526 {"header", required_argument, 0, 'k'}, 529 {"header", required_argument, 0, 'k'},
530 {"no-body", no_argument, 0, 'N'},
527 {"invert-regex", no_argument, NULL, INVERT_REGEX}, 531 {"invert-regex", no_argument, NULL, INVERT_REGEX},
528 {"extended-perfdata", no_argument, 0, 'E'}, 532 {"extended-perfdata", no_argument, 0, 'E'},
529 {0, 0, 0, 0} 533 {0, 0, 0, 0}
@@ -533,7 +537,7 @@ process_arguments (int argc, char **argv)
533 return ERROR; 537 return ERROR;
534 538
535 while (1) { 539 while (1) {
536 c = getopt_long (argc, argv, "Vvht:c:w:A:k:H:j:I:a:p:s:r:u:f:C:J:K:S::E", longopts, &option); 540 c = getopt_long (argc, argv, "Vvht:c:w:A:k:H:j:I:a:p:s:r:u:f:C:J:K:S::NE", longopts, &option);
537 if (c == -1 || c == EOF || c == 1) 541 if (c == -1 || c == EOF || c == 1)
538 break; 542 break;
539 543
@@ -716,6 +720,9 @@ process_arguments (int argc, char **argv)
716 case INVERT_REGEX: 720 case INVERT_REGEX:
717 invert_regex = 1; 721 invert_regex = 1;
718 break; 722 break;
723 case 'N': /* no-body */
724 no_body = TRUE;
725 break;
719 case 'E': /* show extended perfdata */ 726 case 'E': /* show extended perfdata */
720 show_extended_perfdata = TRUE; 727 show_extended_perfdata = TRUE;
721 break; 728 break;
@@ -829,6 +836,9 @@ print_help (void)
829 printf (" %s\n", _("URL to GET or POST (default: /)")); 836 printf (" %s\n", _("URL to GET or POST (default: /)"));
830 printf (" %s\n", "-j, --method=STRING (for example: HEAD, OPTIONS, TRACE, PUT, DELETE, CONNECT)"); 837 printf (" %s\n", "-j, --method=STRING (for example: HEAD, OPTIONS, TRACE, PUT, DELETE, CONNECT)");
831 printf (" %s\n", _("Set HTTP method.")); 838 printf (" %s\n", _("Set HTTP method."));
839 printf (" %s\n", "-N, --no-body");
840 printf (" %s\n", _("Don't wait for document body: stop reading after headers."));
841 printf (" %s\n", _("(Note that this still does an HTTP GET or POST, not a HEAD.)"));
832 printf (" %s\n", "-r, --regex, --ereg=STRING"); 842 printf (" %s\n", "-r, --regex, --ereg=STRING");
833 printf (" %s\n", _("Search page for regex STRING")); 843 printf (" %s\n", _("Search page for regex STRING"));
834 printf (" %s\n", "-a, --authorization=AUTH_PAIR"); 844 printf (" %s\n", "-a, --authorization=AUTH_PAIR");
@@ -910,6 +920,7 @@ print_usage (void)
910 printf (" [-w <warn time>] [-c <critical time>] [-t <timeout>] [-E] [-a auth]\n"); 920 printf (" [-w <warn time>] [-c <critical time>] [-t <timeout>] [-E] [-a auth]\n");
911 printf (" [-f <ok|warning|critcal|follow>]\n"); 921 printf (" [-f <ok|warning|critcal|follow>]\n");
912 printf (" [-s string] [-r <regex>\n"); 922 printf (" [-s string] [-r <regex>\n");
923 printf (" [-N]\n");
913 printf (" [-A string] [-k string] [-S <version>] [-C]\n"); 924 printf (" [-A string] [-k string] [-S <version>] [-C]\n");
914 printf (" [-v verbose]\n", progname); 925 printf (" [-v verbose]\n", progname);
915 printf ("\n"); 926 printf ("\n");