From 47cdfb6f30f7d56bffb806cc860e20806ea62f50 Mon Sep 17 00:00:00 2001 From: Alejandro Colomar Date: Mon, 22 May 2023 02:37:01 +0200 Subject: Tests: fixed incorrect pointer assignment. If we don't update the pointer before copying the request body, then we get the behavior shown below. After this patch, "foo\n" is rightly appended at the end of the response body. Request: "GET / HTTP/1.1\r\nHost: _\nContent-Length: 4\n\nfoo\n" Response body: """ Hello world! foo est data: Method: GET Protocol: HTTP/1.1 Remote addr: 127.0.0.1 Local addr: 127.0.0.1 Target: / Path: / Fields: Host: _ Content-Length: 4 Body: """ Fixes: 1bb22d1e922c ("Unit application library.") Reviewed-by: Andrew Clayton Signed-off-by: Alejandro Colomar --- src/test/nxt_unit_app_test.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) (limited to 'src/test') diff --git a/src/test/nxt_unit_app_test.c b/src/test/nxt_unit_app_test.c index d83bd83a..5dcebe18 100644 --- a/src/test/nxt_unit_app_test.c +++ b/src/test/nxt_unit_app_test.c @@ -257,8 +257,8 @@ greeting_app_request_handler(nxt_unit_request_info_t *req) if (r->content_length > 0) { p = copy(p, BODY, nxt_length(BODY)); - res = nxt_unit_request_read(req, buf->free, buf->end - buf->free); - buf->free += res; + res = nxt_unit_request_read(req, p, buf->end - p); + p += res; } -- cgit