diff options
author | Andreas Baumann <mail@andreasbaumann.cc> | 2018-06-02 13:17:04 +0200 |
---|---|---|
committer | Sven Nierlein <sven@nierlein.de> | 2018-10-22 16:30:31 +0200 |
commit | bd7fe411d5f67b2de7d519da0575654585d1d321 (patch) | |
tree | 7d55b119ce8e1de232976eb60396a2868e9998d6 /plugins | |
parent | df5be47f84c06d2fd481439793dc86494fdc0d7a (diff) | |
download | monitoring-plugins-bd7fe411d5f67b2de7d519da0575654585d1d321.tar.gz |
check_curl: made HTTP message optional
Diffstat (limited to 'plugins')
-rw-r--r-- | plugins/check_curl.c | 5 |
1 files changed, 3 insertions, 2 deletions
diff --git a/plugins/check_curl.c b/plugins/check_curl.c index 715af431..4e65fea7 100644 --- a/plugins/check_curl.c +++ b/plugins/check_curl.c @@ -725,6 +725,7 @@ GOT_FIRST_CERT: die (STATE_CRITICAL, _("HTTP CRITICAL - No header received from host\n")); /* get status line of answer, check sanity of HTTP code */ + strcpy( header_buf.buf, "HTTP/1.1 200\r\nServer: unkown\r\n\r\n" ); if (curlhelp_parse_statusline (header_buf.buf, &status_line) < 0) { snprintf (msg, DEFAULT_BUFFER_SIZE, "Unparsable status line in %.3g seconds response time|%s\n", total_time, perfstring); @@ -1865,7 +1866,7 @@ curlhelp_parse_statusline (const char *buf, curlhelp_statusline *status_line) char *pp; const char *start; char *first_line_buf; - + /* find last start of a new header */ start = strrstr2 (buf, "\r\nHTTP"); if (start != NULL) { @@ -1921,7 +1922,7 @@ curlhelp_parse_statusline (const char *buf, curlhelp_statusline *status_line) /* Human readable message: "Not Found" CRLF */ p = strtok( NULL, "" ); - if( p == NULL ) { free( status_line->first_line ); return -1; } + if( p == NULL ) { status_line->msg = ""; return 0; } status_line->msg = status_line->first_line + ( p - first_line_buf ); free( first_line_buf ); |