commit f7bae2ce3ea4c4ef4082a754a105982c84828698
parent 30bf05560d6e1c87dc1ea91cde5d58330c53af22
Author: Evgeny Grin (Karlson2k) <k2k@narod.ru>
Date: Sat, 17 Jun 2023 17:22:54 +0300
Minor refactoring for partially processed request body
Diffstat:
2 files changed, 12 insertions(+), 7 deletions(-)
diff --git a/src/microhttpd/connection.c b/src/microhttpd/connection.c
@@ -3534,8 +3534,6 @@ process_request_body (struct MHD_Connection *connection)
bool instant_retry;
char *buffer_head;
- connection->rq.some_payload_processed = false;
-
mhd_assert (NULL == connection->rp.response);
buffer_head = connection->read_buffer;
@@ -3546,6 +3544,8 @@ process_request_body (struct MHD_Connection *connection)
size_t left_unprocessed;
size_t processed_size;
+ connection->rq.some_payload_processed = false;
+
instant_retry = false;
if (connection->rq.have_chunked_upload)
{
diff --git a/src/microhttpd/internal.h b/src/microhttpd/internal.h
@@ -1132,14 +1132,19 @@ struct MHD_Request
uint64_t current_chunk_offset;
/**
- * Indicate that some of the upload payload data have been processed
- * by the last call of the connection handler.
+ * Indicate that some of the upload payload data (from the currently
+ * processed chunk for chunked uploads) have been processed by the
+ * last call of the connection handler.
* If any data have been processed, but some data left in the buffer
* for further processing, then MHD will use zero timeout before the
- * next data processing round.
+ * next data processing round. This allow the application handler
+ * process the data by the fixed portions or other way suitable for
+ * application developer.
* If no data have been processed, than MHD will wait for more data
- * to come (as it makes no sense to call the connection handler with
- * the same conditions).
+ * to come (as it makes no sense to call the same connection handler
+ * under the same conditions). However this is dangerous as if buffer
+ * is completely used then connection is aborted. Connection
+ * suspension should be used in such case.
*/
bool some_payload_processed;