[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[libmicrohttpd] 01/02: Added new connection state MHD_CONNECTION_REQ_LIN
From: |
gnunet |
Subject: |
[libmicrohttpd] 01/02: Added new connection state MHD_CONNECTION_REQ_LINE_RECEIVING |
Date: |
Sat, 21 Aug 2021 18:55: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 37593020c7a414e7e65bd56ad55a4ba8c1c832eb
Author: Evgeny Grin (Karlson2k) <k2k@narod.ru>
AuthorDate: Sat Aug 21 19:44:48 2021 +0300
Added new connection state MHD_CONNECTION_REQ_LINE_RECEIVING
This allow to distinguish between connections received any data and
connections without any incoming data.
---
src/microhttpd/connection.c | 9 +++++++++
src/microhttpd/internal.h | 8 +++++++-
2 files changed, 16 insertions(+), 1 deletion(-)
diff --git a/src/microhttpd/connection.c b/src/microhttpd/connection.c
index 104df287..c5f86cc2 100644
--- a/src/microhttpd/connection.c
+++ b/src/microhttpd/connection.c
@@ -2238,6 +2238,7 @@ MHD_connection_update_event_loop_info (struct
MHD_Connection *connection)
switch (connection->state)
{
case MHD_CONNECTION_INIT:
+ case MHD_CONNECTION_REQ_LINE_RECEIVING:
case MHD_CONNECTION_URL_RECEIVED:
case MHD_CONNECTION_HEADER_PART_RECEIVED:
/* while reading headers, we always grow the
@@ -3529,6 +3530,7 @@ MHD_connection_handle_read (struct MHD_Connection
*connection)
switch (connection->state)
{
case MHD_CONNECTION_INIT:
+ case MHD_CONNECTION_REQ_LINE_RECEIVING:
case MHD_CONNECTION_URL_RECEIVED:
case MHD_CONNECTION_HEADER_PART_RECEIVED:
case MHD_CONNECTION_HEADERS_RECEIVED:
@@ -3597,6 +3599,7 @@ MHD_connection_handle_write (struct MHD_Connection
*connection)
switch (connection->state)
{
case MHD_CONNECTION_INIT:
+ case MHD_CONNECTION_REQ_LINE_RECEIVING:
case MHD_CONNECTION_URL_RECEIVED:
case MHD_CONNECTION_HEADER_PART_RECEIVED:
case MHD_CONNECTION_HEADERS_RECEIVED:
@@ -4103,6 +4106,7 @@ MHD_connection_handle_idle (struct MHD_Connection
*connection)
switch (connection->state)
{
case MHD_CONNECTION_INIT:
+ case MHD_CONNECTION_REQ_LINE_RECEIVING:
line = get_next_header_line (connection,
&line_len);
if (NULL != line)
@@ -4110,8 +4114,11 @@ MHD_connection_handle_idle (struct MHD_Connection
*connection)
/* Check for empty string, as we might want
to tolerate 'spurious' empty lines */
if (0 == line[0])
+ {
/* TODO: Add MHD option to not tolerate it */
+ connection->state = MHD_CONNECTION_INIT;
continue; /* Process the next line */
+ }
if (MHD_NO == parse_initial_message_line (connection,
line,
line_len))
@@ -4130,6 +4137,8 @@ MHD_connection_handle_idle (struct MHD_Connection
*connection)
mhd_assert (MHD_CONNECTION_INIT != connection->state);
continue;
}
+ if (0 < connection->read_buffer_offset)
+ connection->state = MHD_CONNECTION_REQ_LINE_RECEIVING;
break;
case MHD_CONNECTION_URL_RECEIVED:
line = get_next_header_line (connection,
diff --git a/src/microhttpd/internal.h b/src/microhttpd/internal.h
index a2a454f1..ae91719e 100644
--- a/src/microhttpd/internal.h
+++ b/src/microhttpd/internal.h
@@ -568,10 +568,16 @@ enum MHD_CONNECTION_STATE
*/
MHD_CONNECTION_INIT = 0,
+ /**
+ * Part of the request line was received.
+ * Wait for complete line.
+ */
+ MHD_CONNECTION_REQ_LINE_RECEIVING = MHD_CONNECTION_INIT + 1,
+
/**
* We got the URL (and request type and version). Wait for a header line.
*/
- MHD_CONNECTION_URL_RECEIVED = MHD_CONNECTION_INIT + 1,
+ MHD_CONNECTION_URL_RECEIVED = MHD_CONNECTION_REQ_LINE_RECEIVING + 1,
/**
* We got part of a multi-line request header. Wait for the rest.
--
To stop receiving notification emails like this one, please contact
gnunet@gnunet.org.