[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[libmicrohttpd] 18/29: Added proper connection's buffers pre-initialisai
From: |
gnunet |
Subject: |
[libmicrohttpd] 18/29: Added proper connection's buffers pre-initialisaion |
Date: |
Tue, 20 Jun 2023 22:24:31 +0200 |
This is an automated email from the git hooks/post-receive script.
karlson2k pushed a commit to branch master
in repository libmicrohttpd.
commit 2e996ee5c2cbf9cb36b12c1152d81b1477607b2c
Author: Evgeny Grin (Karlson2k) <k2k@narod.ru>
AuthorDate: Wed Jun 14 10:49:10 2023 +0300
Added proper connection's buffers pre-initialisaion
---
src/microhttpd/connection.c | 41 +++++++++++++++++++++++++++++++++++++++++
src/microhttpd/connection.h | 8 ++++++++
src/microhttpd/daemon.c | 3 +++
3 files changed, 52 insertions(+)
diff --git a/src/microhttpd/connection.c b/src/microhttpd/connection.c
index be9c5525..4716eb0f 100644
--- a/src/microhttpd/connection.c
+++ b/src/microhttpd/connection.c
@@ -6068,6 +6068,47 @@ cleanup_connection (struct MHD_Connection *connection)
}
+/**
+ * Set initial internal states for the connection to start reading and
+ * processing incoming data.
+ * @param c the connection to process
+ */
+void
+MHD_connection_set_initial_state_ (struct MHD_Connection *c)
+{
+ size_t read_buf_size;
+
+#ifdef HTTPS_SUPPORT
+ mhd_assert ( (0 == (c->daemon->options & MHD_USE_TLS)) || \
+ (MHD_TLS_CONN_INIT == c->tls_state) );
+ mhd_assert ( (0 != (c->daemon->options & MHD_USE_TLS)) || \
+ (MHD_TLS_CONN_NO_TLS == c->tls_state) );
+#endif /* HTTPS_SUPPORT */
+ mhd_assert (MHD_CONNECTION_INIT == c->state);
+
+ c->keepalive = MHD_CONN_KEEPALIVE_UNKOWN;
+ c->event_loop_info = MHD_EVENT_LOOP_INFO_READ;
+
+ memset (&c->rq, 0, sizeof(c->rq));
+ memset (&c->rp, 0, sizeof(c->rp));
+
+ c->write_buffer = NULL;
+ c->write_buffer_size = 0;
+ c->write_buffer_send_offset = 0;
+ c->write_buffer_append_offset = 0;
+
+ c->continue_message_write_offset = 0;
+
+ c->read_buffer_offset = 0;
+ read_buf_size = c->daemon->pool_size / 2;
+ c->read_buffer
+ = MHD_pool_allocate (c->pool,
+ read_buf_size,
+ false);
+ c->read_buffer_size = read_buf_size;
+}
+
+
/**
* Reset connection after request-reply cycle.
* @param connection the connection to process
diff --git a/src/microhttpd/connection.h b/src/microhttpd/connection.h
index 693e26fc..67a251a8 100644
--- a/src/microhttpd/connection.h
+++ b/src/microhttpd/connection.h
@@ -86,6 +86,14 @@ void
MHD_set_http_callbacks_ (struct MHD_Connection *connection);
+/**
+ * Set initial internal states for the connection to start reading and
+ * processing incoming data.
+ * @param c the connection to process
+ */
+void
+MHD_connection_set_initial_state_ (struct MHD_Connection *c);
+
/**
* This function handles a particular connection when it has been
* determined that there is data to be read off a socket. All
diff --git a/src/microhttpd/daemon.c b/src/microhttpd/daemon.c
index f9ffb388..f310e1c7 100644
--- a/src/microhttpd/daemon.c
+++ b/src/microhttpd/daemon.c
@@ -2801,6 +2801,9 @@ new_connection_process_ (struct MHD_Daemon *daemon,
connection);
}
MHD_mutex_unlock_chk_ (&daemon->cleanup_connection_mutex);
+
+ MHD_connection_set_initial_state_ (connection);
+
if (NULL != daemon->notify_connection)
daemon->notify_connection (daemon->notify_connection_cls,
connection,
--
To stop receiving notification emails like this one, please contact
gnunet@gnunet.org.
- [libmicrohttpd] 16/29: Added tests with single and double folded header, (continued)
- [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
- [libmicrohttpd] 18/29: Added proper connection's buffers pre-initialisaion,
gnunet <=
- [libmicrohttpd] 17/29: connection.c: corrected error responses, gnunet, 2023/06/20
- [libmicrohttpd] 24/29: process new connection: fixed missing mutex unlock in error handling path, gnunet, 2023/06/20
- [libmicrohttpd] 23/29: Adjusted buffer increase default step size, gnunet, 2023/06/20
- [libmicrohttpd] 28/29: try_grow_read_buffer(): better handling of edge cases, gnunet, 2023/06/20
- [libmicrohttpd] 26/29: W32 VS Projects: fixed code parsing, gnunet, 2023/06/20
- [libmicrohttpd] 27/29: Fixed some comments, gnunet, 2023/06/20
- [libmicrohttpd] 25/29: Fixed possible timeout value trim on 32-bits platforms, gnunet, 2023/06/20
- [libmicrohttpd] 29/29: Focused all read-buffer grows in a single point, related improvements., gnunet, 2023/06/20