From 2f950e87d6f06e7bf21699c5b704786f8590b814 Mon Sep 17 00:00:00 2001 From: Relintai Date: Sun, 10 Mar 2024 07:05:25 +0100 Subject: [PATCH] Only count request size when not writing to a file. --- modules/http_server_simple/http_parser.cpp | 10 ++++++---- 1 file changed, 6 insertions(+), 4 deletions(-) diff --git a/modules/http_server_simple/http_parser.cpp b/modules/http_server_simple/http_parser.cpp index 3c1dc3523..ace71de55 100644 --- a/modules/http_server_simple/http_parser.cpp +++ b/modules/http_server_simple/http_parser.cpp @@ -84,13 +84,15 @@ int HTTPParser::read_from_buffer(const char *p_buffer, const int p_data_length) parsed_bytes = static_cast(http_parser_execute(parser, settings, p_buffer, p_data_length)); - _current_request_size += parsed_bytes; + if (!_upload_file_access) { + _current_request_size += parsed_bytes; - if (_current_request_size >= max_request_size) { - _error = true; + if (_current_request_size >= max_request_size) { + _error = true; #if PROTOCOL_ERROR_LOGGING_ENABLED - PLOG_ERR("_current_request_size >= max_request_size"); + PLOG_ERR("_current_request_size >= max_request_size"); #endif + } } return parsed_bytes;