libmicrohttpd

HTTP/1.x server C library (MHD 1.x, stable)
Log | Files | Refs | Submodules | README | LICENSE

commit 466a56e3afea831bc8c215d32c6904f2f05c7e0d
parent 2143696e9f26a39dbd2a26c8775da0ef0212013d
Author: Evgeny Grin (Karlson2k) <k2k@narod.ru>
Date:   Sun, 15 Aug 2021 15:45:44 +0300

test_get_chunked: set footer when last chunk is being sending

Diffstat:
Msrc/testcurl/test_get_chunked.c | 8+++++---
1 file changed, 5 insertions(+), 3 deletions(-)

diff --git a/src/testcurl/test_get_chunked.c b/src/testcurl/test_get_chunked.c @@ -137,14 +137,16 @@ crc (void *cls, { struct MHD_Response **responseptr = cls; - if (resp_empty || (pos == RESP_SIZE)) - { + if (resp_empty || (pos == RESP_SIZE - RESP_BLOCK_SIZE)) + { /* Add footer with the last block */ if (MHD_YES != MHD_add_response_footer (*responseptr, RESP_FOOTER_NAME, RESP_FOOTER_VALUE)) abort (); - return MHD_CONTENT_READER_END_OF_STREAM; } + if (resp_empty || (pos == RESP_SIZE)) + return MHD_CONTENT_READER_END_OF_STREAM; + if (max < RESP_BLOCK_SIZE) abort (); /* should not happen in this testcase... */ memset (buf, 'A' + (pos / RESP_BLOCK_SIZE), RESP_BLOCK_SIZE);