summaryrefslogtreecommitdiffstats
path: root/plugins/check_curl.c
diff options
context:
space:
mode:
authorSven Nierlein <sven@nierlein.de>2018-05-28 14:19:02 +0200
committerSven Nierlein <sven@nierlein.de>2018-10-22 16:30:31 +0200
commit5368e24616454ad8833af37e2fa0eb88ce5812ac (patch)
treee4e8afb4e022fa8e74d47ae16f84e1aa85add38f /plugins/check_curl.c
parent8120c53f903c684f78df925ae5a6d615f5154058 (diff)
downloadmonitoring-plugins-5368e24616454ad8833af37e2fa0eb88ce5812ac.tar.gz
check_curl: cleanup
- remove obsolete todos - change exit code to unknown if regex exectute fails Signed-off-by: Sven Nierlein <sven@nierlein.de>
Diffstat (limited to 'plugins/check_curl.c')
-rw-r--r--plugins/check_curl.c20
1 files changed, 2 insertions, 18 deletions
diff --git a/plugins/check_curl.c b/plugins/check_curl.c
index db1e9c5a..9e13766a 100644
--- a/plugins/check_curl.c
+++ b/plugins/check_curl.c
@@ -744,7 +744,6 @@ GOT_FIRST_CERT:
744 744
745 /* make sure the status line matches the response we are looking for */ 745 /* make sure the status line matches the response we are looking for */
746 if (!expected_statuscode(status_line.first_line, server_expect)) { 746 if (!expected_statuscode(status_line.first_line, server_expect)) {
747 /* TODO: fix first_line being cut off */
748 if (server_port == HTTP_PORT) 747 if (server_port == HTTP_PORT)
749 snprintf(msg, DEFAULT_BUFFER_SIZE, _("Invalid HTTP response received from host: %s\n"), status_line.first_line); 748 snprintf(msg, DEFAULT_BUFFER_SIZE, _("Invalid HTTP response received from host: %s\n"), status_line.first_line);
750 else 749 else
@@ -752,7 +751,6 @@ GOT_FIRST_CERT:
752 die (STATE_CRITICAL, "HTTP CRITICAL - %s", msg); 751 die (STATE_CRITICAL, "HTTP CRITICAL - %s", msg);
753 } 752 }
754 753
755 /* TODO: implement -d header tests */
756 if( server_expect_yn ) { 754 if( server_expect_yn ) {
757 snprintf(msg, DEFAULT_BUFFER_SIZE, _("Status line output matched \"%s\" - "), server_expect); 755 snprintf(msg, DEFAULT_BUFFER_SIZE, _("Status line output matched \"%s\" - "), server_expect);
758 if (verbose) 756 if (verbose)
@@ -854,27 +852,13 @@ GOT_FIRST_CERT:
854 result = STATE_CRITICAL; 852 result = STATE_CRITICAL;
855 } 853 }
856 else { 854 else {
857 /* FIXME: Shouldn't that be UNKNOWN? */
858 regerror (errcode, &preg, errbuf, MAX_INPUT_BUFFER); 855 regerror (errcode, &preg, errbuf, MAX_INPUT_BUFFER);
859 snprintf (msg, DEFAULT_BUFFER_SIZE, _("%sExecute Error: %s, "), msg, errbuf); 856 snprintf (msg, DEFAULT_BUFFER_SIZE, _("%sExecute Error: %s, "), msg, errbuf);
860 result = STATE_CRITICAL; 857 result = STATE_UNKNOWN;
861 } 858 }
862 } 859 }
863 860
864 /* make sure the page is of an appropriate size 861 /* make sure the page is of an appropriate size */
865 * TODO: as far I can tell check_http gets the full size of header and
866 * if -N is not given header+body. Does this make sense?
867 *
868 * TODO: check_http.c had a get_length function, the question is really
869 * here what to use? the raw data size of the header_buf, the value of
870 * Content-Length, both and warn if they differ? Should the length be
871 * header+body or only body?
872 *
873 * One possible policy:
874 * - use header_buf.buflen (warning, if it mismatches to the Content-Length value
875 * - if -N (nobody) is given, use Content-Length only and hope the server set
876 * the value correcly
877 */
878 page_len = get_content_length(&header_buf, &body_buf); 862 page_len = get_content_length(&header_buf, &body_buf);
879 if ((max_page_len > 0) && (page_len > max_page_len)) { 863 if ((max_page_len > 0) && (page_len > max_page_len)) {
880 snprintf (msg, DEFAULT_BUFFER_SIZE, _("%spage size %d too large, "), msg, page_len); 864 snprintf (msg, DEFAULT_BUFFER_SIZE, _("%spage size %d too large, "), msg, page_len);