[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[libmicrohttpd] 12/15: test_head: added check for excess data in reply
From: |
gnunet |
Subject: |
[libmicrohttpd] 12/15: test_head: added check for excess data in reply |
Date: |
Fri, 28 Oct 2022 11:22:01 +0200 |
This is an automated email from the git hooks/post-receive script.
karlson2k pushed a commit to branch master
in repository libmicrohttpd.
commit b44b4f73dd5e3920983f885722a4b7a572b41e10
Author: Evgeny Grin (Karlson2k) <k2k@narod.ru>
AuthorDate: Sat Oct 22 18:28:09 2022 +0300
test_head: added check for excess data in reply
---
src/testcurl/test_head.c | 50 ++++++++++++++++++++++++++++++++++++++++++++++++
1 file changed, 50 insertions(+)
diff --git a/src/testcurl/test_head.c b/src/testcurl/test_head.c
index 6ce78217..27daf66e 100644
--- a/src/testcurl/test_head.c
+++ b/src/testcurl/test_head.c
@@ -434,6 +434,54 @@ setCURL_rq_path (CURL *c, int uri_exist)
}
+static int
+libcurl_debug_cb (CURL *handle,
+ curl_infotype type,
+ char *data,
+ size_t size,
+ void *userptr)
+{
+ static const char excess_mark[] = "Excess found";
+ static const size_t excess_mark_len = MHD_STATICSTR_LEN_ (excess_mark);
+
+ (void) handle;
+ (void) userptr;
+
+#ifdef _DEBUG
+ switch (type)
+ {
+ case CURLINFO_TEXT:
+ fprintf (stderr, "* %.*s", (int) size, data);
+ break;
+ case CURLINFO_HEADER_IN:
+ fprintf (stderr, "< %.*s", (int) size, data);
+ break;
+ case CURLINFO_HEADER_OUT:
+ fprintf (stderr, "> %.*s", (int) size, data);
+ break;
+ case CURLINFO_DATA_IN:
+#if 0
+ fprintf (stderr, "<| %.*s\n", (int) size, data);
+#endif
+ break;
+ case CURLINFO_DATA_OUT:
+ case CURLINFO_SSL_DATA_IN:
+ case CURLINFO_SSL_DATA_OUT:
+ case CURLINFO_END:
+ default:
+ break;
+ }
+#endif /* _DEBUG */
+ if (CURLINFO_TEXT == type)
+ {
+ if ((size >= excess_mark_len) &&
+ (0 == memcmp (data, excess_mark, excess_mark_len)))
+ mhdErrorExitDesc ("Extra data has been detected in MHD reply");
+ }
+ return 0;
+}
+
+
static CURL *
setupCURL (void *cbc, uint16_t port,
struct headers_check_result *hdr_chk_result)
@@ -466,6 +514,8 @@ setupCURL (void *cbc, uint16_t port,
#ifdef _DEBUG
(CURLE_OK != curl_easy_setopt (c, CURLOPT_VERBOSE, 1L)) ||
#endif /* _DEBUG */
+ (CURLE_OK != curl_easy_setopt (c, CURLOPT_DEBUGFUNCTION,
+ &libcurl_debug_cb)) ||
#if CURL_AT_LEAST_VERSION (7, 19, 4)
(CURLE_OK != curl_easy_setopt (c, CURLOPT_PROTOCOLS, CURLPROTO_HTTP)) ||
#endif /* CURL_AT_LEAST_VERSION (7, 19, 4) */
--
To stop receiving notification emails like this one, please contact
gnunet@gnunet.org.
- [libmicrohttpd] branch master updated (5e0c2223 -> 9f4a08a8), gnunet, 2022/10/28
- [libmicrohttpd] 03/15: New values for MHD_ConnectionEventLoopInfo, gnunet, 2022/10/28
- [libmicrohttpd] 12/15: test_head: added check for excess data in reply,
gnunet <=
- [libmicrohttpd] 04/15: Added new state for MHD_ConnectionEventLoopInfo, gnunet, 2022/10/28
- [libmicrohttpd] 14/15: postprocessor.h: fixed typos in doxy, gnunet, 2022/10/28
- [libmicrohttpd] 11/15: testcurl: added test with Content-Length broken value in request, gnunet, 2022/10/28
- [libmicrohttpd] 08/15: Do not send "100 Continue" if part of the request body is already received, gnunet, 2022/10/28
- [libmicrohttpd] 01/15: Added ability to check for MHD debug builds at run-time, gnunet, 2022/10/28
- [libmicrohttpd] 02/15: Added check for hypothetical too large accepted sockets addresses, gnunet, 2022/10/28
- [libmicrohttpd] 13/15: test_head: check libcurl for timeout value, gnunet, 2022/10/28
- [libmicrohttpd] 06/15: Renamed one more connection state for clarity, gnunet, 2022/10/28
- [libmicrohttpd] 05/15: Renamed one state in MHD_ConnectionEventLoopInfo for clarity, gnunet, 2022/10/28
- [libmicrohttpd] 10/15: connection.c: fixed handling of various errors automatically detected by MHD code, gnunet, 2022/10/28