summaryrefslogtreecommitdiffstats
path: root/plugins
diff options
context:
space:
mode:
authorAndreas Baumann <mail@andreasbaumann.cc>2018-06-02 11:17:04 (GMT)
committerSven Nierlein <sven@nierlein.de>2018-10-22 14:30:31 (GMT)
commitbd7fe411d5f67b2de7d519da0575654585d1d321 (patch)
tree7d55b119ce8e1de232976eb60396a2868e9998d6 /plugins
parentdf5be47f84c06d2fd481439793dc86494fdc0d7a (diff)
downloadmonitoring-plugins-bd7fe411d5f67b2de7d519da0575654585d1d321.tar.gz
check_curl: made HTTP message optional
Diffstat (limited to 'plugins')
-rw-r--r--plugins/check_curl.c5
1 files changed, 3 insertions, 2 deletions
diff --git a/plugins/check_curl.c b/plugins/check_curl.c
index 715af43..4e65fea 100644
--- a/plugins/check_curl.c
+++ b/plugins/check_curl.c
@@ -725,6 +725,7 @@ GOT_FIRST_CERT:
725 die (STATE_CRITICAL, _("HTTP CRITICAL - No header received from host\n")); 725 die (STATE_CRITICAL, _("HTTP CRITICAL - No header received from host\n"));
726 726
727 /* get status line of answer, check sanity of HTTP code */ 727 /* get status line of answer, check sanity of HTTP code */
728 strcpy( header_buf.buf, "HTTP/1.1 200\r\nServer: unkown\r\n\r\n" );
728 if (curlhelp_parse_statusline (header_buf.buf, &status_line) < 0) { 729 if (curlhelp_parse_statusline (header_buf.buf, &status_line) < 0) {
729 snprintf (msg, DEFAULT_BUFFER_SIZE, "Unparsable status line in %.3g seconds response time|%s\n", 730 snprintf (msg, DEFAULT_BUFFER_SIZE, "Unparsable status line in %.3g seconds response time|%s\n",
730 total_time, perfstring); 731 total_time, perfstring);
@@ -1865,7 +1866,7 @@ curlhelp_parse_statusline (const char *buf, curlhelp_statusline *status_line)
1865 char *pp; 1866 char *pp;
1866 const char *start; 1867 const char *start;
1867 char *first_line_buf; 1868 char *first_line_buf;
1868 1869
1869 /* find last start of a new header */ 1870 /* find last start of a new header */
1870 start = strrstr2 (buf, "\r\nHTTP"); 1871 start = strrstr2 (buf, "\r\nHTTP");
1871 if (start != NULL) { 1872 if (start != NULL) {
@@ -1921,7 +1922,7 @@ curlhelp_parse_statusline (const char *buf, curlhelp_statusline *status_line)
1921 /* Human readable message: "Not Found" CRLF */ 1922 /* Human readable message: "Not Found" CRLF */
1922 1923
1923 p = strtok( NULL, "" ); 1924 p = strtok( NULL, "" );
1924 if( p == NULL ) { free( status_line->first_line ); return -1; } 1925 if( p == NULL ) { status_line->msg = ""; return 0; }
1925 status_line->msg = status_line->first_line + ( p - first_line_buf ); 1926 status_line->msg = status_line->first_line + ( p - first_line_buf );
1926 free( first_line_buf ); 1927 free( first_line_buf );
1927 1928