[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[libmicrohttpd] 02/03: Simplified call of MHD_send_on_connection2_()
From: |
gnunet |
Subject: |
[libmicrohttpd] 02/03: Simplified call of MHD_send_on_connection2_() |
Date: |
Sat, 12 Dec 2020 16:45:48 +0100 |
This is an automated email from the git hooks/post-receive script.
karlson2k pushed a commit to branch master
in repository libmicrohttpd.
commit 3b435274a2b3cd206201cc6140f2c70016a03bd2
Author: Evgeny Grin (Karlson2k) <k2k@narod.ru>
AuthorDate: Sat Dec 12 17:39:09 2020 +0300
Simplified call of MHD_send_on_connection2_()
---
src/microhttpd/connection.c | 40 ++++++++++++++++------------------------
1 file changed, 16 insertions(+), 24 deletions(-)
diff --git a/src/microhttpd/connection.c b/src/microhttpd/connection.c
index 20e31998..74f07408 100644
--- a/src/microhttpd/connection.c
+++ b/src/microhttpd/connection.c
@@ -2917,25 +2917,18 @@ MHD_connection_handle_write (struct MHD_Connection
*connection)
- connection->write_buffer_send_offset;
mhd_assert (connection->write_buffer_append_offset >= \
connection->write_buffer_send_offset);
-
- /* if the response body is not available, we use
MHD_send_on_connection_() */
- if (NULL != connection->response->crc)
- {
- ret = MHD_send_on_connection_ (connection,
- &connection->write_buffer
- [connection->write_buffer_send_offset],
- wb_ready,
- MHD_SSO_PREFER_BUFF);
- }
- else
- {
- ret = MHD_send_on_connection2_ (connection,
- &connection->write_buffer
- [connection->write_buffer_send_offset],
- wb_ready,
- connection->response->data,
- connection->response->data_size);
- }
+ mhd_assert (NULL != connection->response);
+ mhd_assert ( (0 == connection->response->data_size) || \
+ (0 == connection->response->data_start) );
+
+ /* Send response headers alongside the response body, if the body
+ * data is available. */
+ ret = MHD_send_on_connection2_ (connection,
+ &connection->write_buffer
+ [connection->write_buffer_send_offset],
+ wb_ready,
+ connection->response->data,
+ connection->response->data_size);
if (ret < 0)
{
@@ -2949,12 +2942,11 @@ MHD_connection_handle_write (struct MHD_Connection
*connection)
/* 'ret' is not negative, it's safe to cast it to 'size_t'. */
if (((size_t) ret) > wb_ready)
{
- mhd_assert (NULL == connection->response->crc);
- /* We sent not just header data but also some response data,
- update both offsets! */
+ /* The complete header and some response data have been sent,
+ * update both offsets. */
+ mhd_assert (! connection->have_chunked_upload);
connection->write_buffer_send_offset += wb_ready;
- ret -= wb_ready;
- connection->response_write_position += ret;
+ connection->response_write_position += ret - wb_ready;
}
else
connection->write_buffer_send_offset += ret;
--
To stop receiving notification emails like this one, please contact
gnunet@gnunet.org.