gnunet-svn
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[libmicrohttpd] branch master updated (4d7d35d8 -> e76e18e4)


From: gnunet
Subject: [libmicrohttpd] branch master updated (4d7d35d8 -> e76e18e4)
Date: Sat, 21 Aug 2021 18:55:30 +0200

This is an automated email from the git hooks/post-receive script.

karlson2k pushed a change to branch master
in repository libmicrohttpd.

    from 4d7d35d8 build_header_response(): clarified comment
     new 37593020 Added new connection state MHD_CONNECTION_REQ_LINE_RECEIVING
     new e76e18e4 Added new connection state MHD_CONNECTION_FULL_REQ_RECEIVED

The 2 revisions listed above as "new" are entirely new to this
repository and will be described in separate emails.  The revisions
listed as "add" were already present in the repository and have only
been added to this reference.


Summary of changes:
 src/microhttpd/connection.c | 32 ++++++++++++++++++++++++++------
 src/microhttpd/internal.h   | 19 +++++++++++++++----
 2 files changed, 41 insertions(+), 10 deletions(-)

diff --git a/src/microhttpd/connection.c b/src/microhttpd/connection.c
index 104df287..bd96b1cf 100644
--- a/src/microhttpd/connection.c
+++ b/src/microhttpd/connection.c
@@ -2126,7 +2126,7 @@ transmit_error_response_len (struct MHD_Connection 
*connection,
   struct MHD_Response *response;
   enum MHD_Result iret;
 
-  connection->state = MHD_CONNECTION_FOOTERS_RECEIVED;
+  connection->state = MHD_CONNECTION_FULL_REQ_RECEIVED;
   connection->stop_with_error = true;
   if (0 != connection->read_buffer_size)
   {
@@ -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
@@ -2315,6 +2316,9 @@ MHD_connection_update_event_loop_info (struct 
MHD_Connection *connection)
          happens in read handler */
       break;
     case MHD_CONNECTION_FOOTERS_RECEIVED:
+      mhd_assert (0);
+      break;
+    case MHD_CONNECTION_FULL_REQ_RECEIVED:
       connection->event_loop_info = MHD_EVENT_LOOP_INFO_BLOCK;
       break;
     case MHD_CONNECTION_HEADERS_SENDING:
@@ -3328,7 +3332,7 @@ 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_FOOTERS_RECEIVED;
+    connection->state = MHD_CONNECTION_FULL_REQ_RECEIVED;
     connection->stop_with_error = true;
 #ifdef HAVE_MESSAGES
     MHD_DLOG (connection->daemon,
@@ -3529,6 +3533,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 +3602,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:
@@ -3637,6 +3643,7 @@ MHD_connection_handle_write (struct MHD_Connection 
*connection)
   case MHD_CONNECTION_BODY_RECEIVED:
   case MHD_CONNECTION_FOOTER_PART_RECEIVED:
   case MHD_CONNECTION_FOOTERS_RECEIVED:
+  case MHD_CONNECTION_FULL_REQ_RECEIVED:
     mhd_assert (0);
     return;
   case MHD_CONNECTION_HEADERS_SENDING:
@@ -4103,6 +4110,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 +4118,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 +4141,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,
@@ -4220,7 +4233,7 @@ MHD_connection_handle_idle (struct MHD_Connection 
*connection)
         connection->stop_with_error = true;
       }
       connection->state = (0 == connection->remaining_upload_size)
-                          ? MHD_CONNECTION_FOOTERS_RECEIVED
+                          ? MHD_CONNECTION_FULL_REQ_RECEIVED
                           : MHD_CONNECTION_CONTINUE_SENT;
       if (connection->suspended)
         break;
@@ -4249,7 +4262,7 @@ MHD_connection_handle_idle (struct MHD_Connection 
*connection)
              (! connection->stop_with_error) )
           connection->state = MHD_CONNECTION_BODY_RECEIVED;
         else
-          connection->state = MHD_CONNECTION_FOOTERS_RECEIVED;
+          connection->state = MHD_CONNECTION_FULL_REQ_RECEIVED;
         if (connection->suspended)
           break;
         continue;
@@ -4268,6 +4281,8 @@ MHD_connection_handle_idle (struct MHD_Connection 
*connection)
                                   NULL);
           continue;
         }
+        if (0 < connection->read_buffer_offset)
+          connection->state = MHD_CONNECTION_FOOTER_PART_RECEIVED;
         break;
       }
       if (0 == line[0])
@@ -4316,6 +4331,11 @@ MHD_connection_handle_idle (struct MHD_Connection 
*connection)
       }
       continue;
     case MHD_CONNECTION_FOOTERS_RECEIVED:
+      /* The header, the body, and the footers of the request has been 
received,
+       * switch to the final processing of the request. */
+      connection->state = MHD_CONNECTION_FULL_REQ_RECEIVED;
+      continue;
+    case MHD_CONNECTION_FULL_REQ_RECEIVED:
       call_connection_handler (connection);     /* "final" call */
       if (connection->state == MHD_CONNECTION_CLOSED)
         continue;
@@ -4751,7 +4771,7 @@ MHD_queue_response (struct MHD_Connection *connection,
        (NULL == response) ||
        (NULL != connection->response) ||
        ( (MHD_CONNECTION_HEADERS_PROCESSED != connection->state) &&
-         (MHD_CONNECTION_FOOTERS_RECEIVED != connection->state) ) )
+         (MHD_CONNECTION_FULL_REQ_RECEIVED != connection->state) ) )
     return MHD_NO;
 
 #ifdef UPGRADE_SUPPORT
@@ -4884,7 +4904,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_FOOTERS_RECEIVED;
+    connection->state = MHD_CONNECTION_FULL_REQ_RECEIVED;
     connection->remaining_upload_size = 0;
   }
   if (! connection->in_idle)
diff --git a/src/microhttpd/internal.h b/src/microhttpd/internal.h
index a2a454f1..ca317748 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.
@@ -610,16 +616,21 @@ enum MHD_CONNECTION_STATE
   MHD_CONNECTION_FOOTER_PART_RECEIVED = MHD_CONNECTION_BODY_RECEIVED + 1,
 
   /**
-   * We received the entire footer.  Wait for a response to be queued
-   * and prepare the response headers.
+   * We received the entire footer.
    */
   MHD_CONNECTION_FOOTERS_RECEIVED = MHD_CONNECTION_FOOTER_PART_RECEIVED + 1,
 
+  /**
+   * We received the entire request.
+   * Wait for a response to be queued and prepare the response headers.
+   */
+  MHD_CONNECTION_FULL_REQ_RECEIVED = MHD_CONNECTION_FOOTERS_RECEIVED + 1,
+
   /**
    * We have prepared the response headers in the writ buffer.
    * Send the response headers.
    */
-  MHD_CONNECTION_HEADERS_SENDING = MHD_CONNECTION_FOOTERS_RECEIVED + 1,
+  MHD_CONNECTION_HEADERS_SENDING = MHD_CONNECTION_FULL_REQ_RECEIVED + 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.



reply via email to

[Prev in Thread] Current Thread [Next in Thread]