libmicrohttpd

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

commit 6123b2ab2b9c658612df3279567dc709d8eb3220
parent 732bc0a0c3971ede380a6237635f383745515aa0
Author: Evgeny Grin (Karlson2k) <k2k@narod.ru>
Date:   Sat,  5 Jun 2021 21:18:55 +0300

Fixed header size calculation.

Previous calculation was incorrect, header size was always
negative (overflow) number.
New calculation takes into account full header size, including
the last empty line with linefeeds.

Diffstat:
Msrc/microhttpd/connection.c | 6++++--
1 file changed, 4 insertions(+), 2 deletions(-)

diff --git a/src/microhttpd/connection.c b/src/microhttpd/connection.c @@ -3550,7 +3550,8 @@ MHD_connection_handle_idle (struct MHD_Connection *connection) if (0 == line[0]) { connection->state = MHD_CONNECTION_HEADERS_RECEIVED; - connection->header_size = (size_t) (line - connection->read_buffer); + connection->header_size = (size_t) (connection->read_buffer + - connection->method); continue; } if (MHD_NO == process_header_line (connection, @@ -3586,7 +3587,8 @@ MHD_connection_handle_idle (struct MHD_Connection *connection) if (0 == line[0]) { connection->state = MHD_CONNECTION_HEADERS_RECEIVED; - connection->header_size = (size_t) (line - connection->read_buffer); + connection->header_size = (size_t) (connection->read_buffer + - connection->method); continue; } continue;