--- a/src/server/test/httpclient.c Sat Feb 28 20:20:48 2026 +0100 +++ b/src/server/test/httpclient.c Sun Mar 01 10:34:54 2026 +0100 @@ -294,3 +294,20 @@ free(req_body); } } + +CX_TEST(test_http_client_get_incorrect_ctlen) { + CX_TEST_DO { + cxstring response = cx_str( + "HTTP/1.1 200 OK\r\n" + "Content-length: 5\r\n" + "\r\n" + "Hello World!\n"); + CxBuffer *out = cxBufferCreate(NULL, NULL, 256, CX_BUFFER_AUTO_EXTEND|CX_BUFFER_FREE_CONTENTS); + + CX_TEST_CALL_SUBROUTINE(test_httpclient, cx_str(NULL), FALSE, &response, 1, out); + CX_TEST_ASSERT(!cx_strcmp(cx_strn(out->space, out->size), "Hello")); + + cxBufferFree(out); + } +} +