[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[libmicrohttpd] 05/29: Request body processing: removed impossible code
From: |
gnunet |
Subject: |
[libmicrohttpd] 05/29: Request body processing: removed impossible code paths |
Date: |
Tue, 20 Jun 2023 22:24:18 +0200 |
This is an automated email from the git hooks/post-receive script.
karlson2k pushed a commit to branch master
in repository libmicrohttpd.
commit 69da856991eeb4fabf519552ff4c55708cb56d0a
Author: Evgeny Grin (Karlson2k) <k2k@narod.ru>
AuthorDate: Fri Feb 24 20:26:35 2023 +0300
Request body processing: removed impossible code paths
Some code paths are impossible. Removed and replaced with asserts.
Also redundant checks are removed.
---
src/microhttpd/connection.c | 36 ++++++++++--------------------------
1 file changed, 10 insertions(+), 26 deletions(-)
diff --git a/src/microhttpd/connection.c b/src/microhttpd/connection.c
index 3fad127d..756aba4f 100644
--- a/src/microhttpd/connection.c
+++ b/src/microhttpd/connection.c
@@ -3402,24 +3402,7 @@ process_request_body (struct MHD_Connection *connection)
connection->rq.some_payload_processed = false;
- if (NULL != connection->rp.response)
- {
- /* TODO: discard all read buffer as early response
- * means that connection have to be closed. */
- /* already queued a response, discard remaining upload
- (but not more, there might be another request after it) */
- size_t purge;
-
- purge = (size_t) MHD_MIN (connection->rq.remaining_upload_size,
- (uint64_t) connection->read_buffer_offset);
- connection->rq.remaining_upload_size -= purge;
- if (connection->read_buffer_offset > purge)
- memmove (connection->read_buffer,
- &connection->read_buffer[purge],
- connection->read_buffer_offset - purge);
- connection->read_buffer_offset -= purge;
- return;
- }
+ mhd_assert (NULL == connection->rp.response);
buffer_head = connection->read_buffer;
available = connection->read_buffer_offset;
@@ -5704,24 +5687,25 @@ MHD_connection_handle_idle (struct MHD_Connection
*connection)
}
break;
case MHD_CONNECTION_BODY_RECEIVING:
+ mhd_assert (0 != connection->rq.remaining_upload_size);
+ mhd_assert (! connection->discard_request);
+ mhd_assert (NULL == connection->rp.response);
if (0 != connection->read_buffer_offset)
{
process_request_body (connection); /* loop call */
if (MHD_CONNECTION_BODY_RECEIVING != connection->state)
continue;
}
- if ( (0 == connection->rq.remaining_upload_size) ||
- ( (MHD_SIZE_UNKNOWN == connection->rq.remaining_upload_size) &&
- (0 == connection->read_buffer_offset) &&
- (connection->discard_request) ) )
+ /* Modify here when response queue during data processing
+ will be supported */
+ mhd_assert (! connection->discard_request);
+ mhd_assert (NULL == connection->rp.response);
+ if (0 == connection->rq.remaining_upload_size)
{
- if ( (connection->rq.have_chunked_upload) &&
- (! connection->discard_request) )
+ if (connection->rq.have_chunked_upload)
connection->state = MHD_CONNECTION_BODY_RECEIVED;
else
connection->state = MHD_CONNECTION_FULL_REQ_RECEIVED;
- if (connection->suspended)
- break;
continue;
}
break;
--
To stop receiving notification emails like this one, please contact
gnunet@gnunet.org.
- [libmicrohttpd] branch master updated (8dc93b08 -> f02888d4), gnunet, 2023/06/20
- [libmicrohttpd] 03/29: microhttpd.h: fixed typos in comments, gnunet, 2023/06/20
- [libmicrohttpd] 04/29: Renamed connection state for clarity, gnunet, 2023/06/20
- [libmicrohttpd] 02/29: Re-implemented parsing of the request line from scratch., gnunet, 2023/06/20
- [libmicrohttpd] 08/29: tests: minor improvemnts, gnunet, 2023/06/20
- [libmicrohttpd] 07/29: Removed request line and headers processing old functions and variables, gnunet, 2023/06/20
- [libmicrohttpd] 09/29: daemon: added debug member to avoid accept4() usage, gnunet, 2023/06/20
- [libmicrohttpd] 01/29: Refactoring: check whether memory block is resizable, gnunet, 2023/06/20
- [libmicrohttpd] 06/29: Re-implemented parsing of the request headers and footers from scratch., gnunet, 2023/06/20
- [libmicrohttpd] 12/29: Added back testing with socat as a fallback option, gnunet, 2023/06/20
- [libmicrohttpd] 05/29: Request body processing: removed impossible code paths,
gnunet <=
- [libmicrohttpd] 16/29: Added tests with single and double folded header, gnunet, 2023/06/20
- [libmicrohttpd] 21/29: process_request_body(): minor readability improvementы, gnunet, 2023/06/20
- [libmicrohttpd] 11/29: testzzuf: re-worked zzuf testing, gnunet, 2023/06/20
- [libmicrohttpd] 10/29: testzzuf: added special debug functions, gnunet, 2023/06/20
- [libmicrohttpd] 22/29: Minor refactoring for partially processed request body, gnunet, 2023/06/20
- [libmicrohttpd] 14/29: Added test with folded header placed last, gnunet, 2023/06/20
- [libmicrohttpd] 15/29: Added test with large folded header, gnunet, 2023/06/20
- [libmicrohttpd] 20/29: Added checks for correct values specified for connection memory limits, gnunet, 2023/06/20
- [libmicrohttpd] 19/29: connection: fixed pipelined requests processing, gnunet, 2023/06/20
- [libmicrohttpd] 13/29: Added new tests with header fold, gnunet, 2023/06/20