[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[libmicrohttpd] branch master updated: Added new connection state MHD_CO
From: |
gnunet |
Subject: |
[libmicrohttpd] branch master updated: Added new connection state MHD_CONNECTION_START_REPLY |
Date: |
Mon, 23 Aug 2021 12:14:58 +0200 |
This is an automated email from the git hooks/post-receive script.
karlson2k pushed a commit to branch master
in repository libmicrohttpd.
The following commit(s) were added to refs/heads/master by this push:
new 11a2e012 Added new connection state MHD_CONNECTION_START_REPLY
11a2e012 is described below
commit 11a2e0126e68fb6f70be1734f54ef9963d6a6352
Author: Evgeny Grin (Karlson2k) <k2k@narod.ru>
AuthorDate: Mon Aug 23 12:54:42 2021 +0300
Added new connection state MHD_CONNECTION_START_REPLY
---
src/microhttpd/connection.c | 22 ++++++++++++++++------
src/microhttpd/internal.c | 14 ++++++++++----
src/microhttpd/internal.h | 13 ++++++++++---
3 files changed, 36 insertions(+), 13 deletions(-)
diff --git a/src/microhttpd/connection.c b/src/microhttpd/connection.c
index bd96b1cf..5cbb30ed 100644
--- a/src/microhttpd/connection.c
+++ b/src/microhttpd/connection.c
@@ -2126,8 +2126,9 @@ transmit_error_response_len (struct MHD_Connection
*connection,
struct MHD_Response *response;
enum MHD_Result iret;
- connection->state = MHD_CONNECTION_FULL_REQ_RECEIVED;
connection->stop_with_error = true;
+ /* TODO: remove when special error queue function is implemented */
+ connection->state = MHD_CONNECTION_FULL_REQ_RECEIVED;
if (0 != connection->read_buffer_size)
{
/* Read buffer is not needed anymore, discard it
@@ -2321,6 +2322,9 @@ MHD_connection_update_event_loop_info (struct
MHD_Connection *connection)
case MHD_CONNECTION_FULL_REQ_RECEIVED:
connection->event_loop_info = MHD_EVENT_LOOP_INFO_BLOCK;
break;
+ case MHD_CONNECTION_START_REPLY:
+ mhd_assert (0);
+ break;
case MHD_CONNECTION_HEADERS_SENDING:
/* headers in buffer, keep writing */
connection->event_loop_info = MHD_EVENT_LOOP_INFO_WRITE;
@@ -3332,8 +3336,8 @@ parse_connection_headers (struct MHD_Connection
*connection)
enum MHD_Result iret;
/* die, http 1.1 request without host and we are pedantic */
- connection->state = MHD_CONNECTION_FULL_REQ_RECEIVED;
connection->stop_with_error = true;
+ connection->state = MHD_CONNECTION_FULL_REQ_RECEIVED;
#ifdef HAVE_MESSAGES
MHD_DLOG (connection->daemon,
_ ("Received HTTP 1.1 request without `Host' header.\n"));
@@ -3644,6 +3648,7 @@ MHD_connection_handle_write (struct MHD_Connection
*connection)
case MHD_CONNECTION_FOOTER_PART_RECEIVED:
case MHD_CONNECTION_FOOTERS_RECEIVED:
case MHD_CONNECTION_FULL_REQ_RECEIVED:
+ case MHD_CONNECTION_START_REPLY:
mhd_assert (0);
return;
case MHD_CONNECTION_HEADERS_SENDING:
@@ -4341,18 +4346,23 @@ MHD_connection_handle_idle (struct MHD_Connection
*connection)
continue;
if (NULL == connection->response)
break; /* try again next time */
-
+ /* Response is ready, start reply */
+ connection->state = MHD_CONNECTION_START_REPLY;
+ continue;
+ case MHD_CONNECTION_START_REPLY:
+ mhd_assert (NULL != connection->response);
connection_switch_from_recv_to_send (connection);
if (MHD_NO == build_header_response (connection))
{
/* oops - close! */
CONNECTION_CLOSE_ERROR (connection,
- _ (
- "Closing connection (failed to create
response header).\n"));
+ _ ("Closing connection (failed to create "
+ "response header).\n"));
continue;
}
connection->state = MHD_CONNECTION_HEADERS_SENDING;
break;
+
case MHD_CONNECTION_HEADERS_SENDING:
/* no default action */
break;
@@ -4904,7 +4914,7 @@ MHD_queue_response (struct MHD_Connection *connection,
/* response was queued "early", refuse to read body / footers or
further requests! */
connection->stop_with_error = true;
- connection->state = MHD_CONNECTION_FULL_REQ_RECEIVED;
+ connection->state = MHD_CONNECTION_START_REPLY;
connection->remaining_upload_size = 0;
}
if (! connection->in_idle)
diff --git a/src/microhttpd/internal.c b/src/microhttpd/internal.c
index c5ffa856..dacb433f 100644
--- a/src/microhttpd/internal.c
+++ b/src/microhttpd/internal.c
@@ -39,6 +39,8 @@ MHD_state_to_string (enum MHD_CONNECTION_STATE state)
{
case MHD_CONNECTION_INIT:
return "connection init";
+ case MHD_CONNECTION_REQ_LINE_RECEIVING:
+ return "receiving request line";
case MHD_CONNECTION_URL_RECEIVED:
return "connection url received";
case MHD_CONNECTION_HEADER_PART_RECEIVED:
@@ -57,18 +59,22 @@ MHD_state_to_string (enum MHD_CONNECTION_STATE state)
return "footer partially received";
case MHD_CONNECTION_FOOTERS_RECEIVED:
return "footers received";
+ case MHD_CONNECTION_FULL_REQ_RECEIVED:
+ return "full request received";
+ case MHD_CONNECTION_START_REPLY:
+ return "start sending reply";
case MHD_CONNECTION_HEADERS_SENDING:
return "headers sending";
case MHD_CONNECTION_HEADERS_SENT:
return "headers sent";
- case MHD_CONNECTION_NORMAL_BODY_READY:
- return "normal body ready";
case MHD_CONNECTION_NORMAL_BODY_UNREADY:
return "normal body unready";
- case MHD_CONNECTION_CHUNKED_BODY_READY:
- return "chunked body ready";
+ case MHD_CONNECTION_NORMAL_BODY_READY:
+ return "normal body ready";
case MHD_CONNECTION_CHUNKED_BODY_UNREADY:
return "chunked body unready";
+ case MHD_CONNECTION_CHUNKED_BODY_READY:
+ return "chunked body ready";
case MHD_CONNECTION_BODY_SENT:
return "body sent";
case MHD_CONNECTION_FOOTERS_SENDING:
diff --git a/src/microhttpd/internal.h b/src/microhttpd/internal.h
index ca317748..5154dc38 100644
--- a/src/microhttpd/internal.h
+++ b/src/microhttpd/internal.h
@@ -622,15 +622,22 @@ enum MHD_CONNECTION_STATE
/**
* We received the entire request.
- * Wait for a response to be queued and prepare the response headers.
+ * Wait for a response to be queued.
*/
MHD_CONNECTION_FULL_REQ_RECEIVED = MHD_CONNECTION_FOOTERS_RECEIVED + 1,
/**
- * We have prepared the response headers in the writ buffer.
+ * Finished reading of the request and the response is ready.
+ * Switch internal logic from receiving to sending, prepare connection
+ * sending the reply and build the reply header.
+ */
+ MHD_CONNECTION_START_REPLY = MHD_CONNECTION_FULL_REQ_RECEIVED + 1,
+
+ /**
+ * We have prepared the response headers in the write buffer.
* Send the response headers.
*/
- MHD_CONNECTION_HEADERS_SENDING = MHD_CONNECTION_FULL_REQ_RECEIVED + 1,
+ MHD_CONNECTION_HEADERS_SENDING = MHD_CONNECTION_START_REPLY + 1,
/**
* We have sent the response headers. Get ready to send the body.
--
To stop receiving notification emails like this one, please contact
gnunet@gnunet.org.
[Prev in Thread] |
Current Thread |
[Next in Thread] |
- [libmicrohttpd] branch master updated: Added new connection state MHD_CONNECTION_START_REPLY,
gnunet <=