summaryrefslogtreecommitdiffstats
path: root/plugins/check_curl.c
diff options
context:
space:
mode:
Diffstat (limited to 'plugins/check_curl.c')
-rw-r--r--plugins/check_curl.c11
1 files changed, 7 insertions, 4 deletions
diff --git a/plugins/check_curl.c b/plugins/check_curl.c
index a2ded89..5f6905f 100644
--- a/plugins/check_curl.c
+++ b/plugins/check_curl.c
@@ -1715,6 +1715,7 @@ check_document_dates (const curlhelp_write_curlbuf *header_buf, char (*msg)[DEFA
1715 return date_result; 1715 return date_result;
1716} 1716}
1717 1717
1718
1718int 1719int
1719get_content_length (const curlhelp_write_curlbuf* header_buf, const curlhelp_write_curlbuf* body_buf) 1720get_content_length (const curlhelp_write_curlbuf* header_buf, const curlhelp_write_curlbuf* body_buf)
1720{ 1721{
@@ -1733,15 +1734,17 @@ get_content_length (const curlhelp_write_curlbuf* header_buf, const curlhelp_wri
1733 1734
1734 content_length_s = get_header_value (headers, nof_headers, "content-length"); 1735 content_length_s = get_header_value (headers, nof_headers, "content-length");
1735 if (!content_length_s) { 1736 if (!content_length_s) {
1736 /* TODO: or header_buf->buflen + body_buf->buflen */ 1737 return header_buf->buflen + body_buf->buflen;
1737 return body_buf->buflen;
1738 } 1738 }
1739 /* TODO: trim */ 1739 content_length_s += strspn (content_length_s, " \t");
1740 content_length = atoi (content_length_s); 1740 content_length = atoi (content_length_s);
1741 if (content_length != body_buf->buflen) {
1742 /* TODO: should we warn if the actual and the reported body length doen't match? */
1743 }
1741 1744
1742 if (content_length_s) free (content_length_s); 1745 if (content_length_s) free (content_length_s);
1743 1746
1744 return content_length; 1747 return header_buf->buflen + body_buf->buflen;
1745} 1748}
1746 1749
1747/* TODO: is there a better way in libcurl to check for the SSL library? */ 1750/* TODO: is there a better way in libcurl to check for the SSL library? */