gnunet-svn
[Top][All Lists]
Advanced

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

[libmicrohttpd] 10/15: connection.c: fixed handling of various errors au


From: gnunet
Subject: [libmicrohttpd] 10/15: connection.c: fixed handling of various errors automatically detected by MHD code
Date: Fri, 28 Oct 2022 11:21:59 +0200

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

karlson2k pushed a commit to branch master
in repository libmicrohttpd.

commit f1bfbe71dcb3c6d30c6d89e165deda6778d422d5
Author: Evgeny Grin (Karlson2k) <k2k@narod.ru>
AuthorDate: Sun Oct 23 12:01:39 2022 +0300

    connection.c: fixed handling of various errors automatically detected by 
MHD code
    
    Make sure that errors replies are processed correctly.
---
 src/microhttpd/connection.c | 27 ++++++++++++++-------------
 1 file changed, 14 insertions(+), 13 deletions(-)

diff --git a/src/microhttpd/connection.c b/src/microhttpd/connection.c
index cc6192ad..798052da 100644
--- a/src/microhttpd/connection.c
+++ b/src/microhttpd/connection.c
@@ -4842,6 +4842,8 @@ MHD_connection_handle_idle (struct MHD_Connection 
*connection)
     case MHD_CONNECTION_REQ_LINE_RECEIVING:
       line = get_next_header_line (connection,
                                    &line_len);
+      if (MHD_CONNECTION_REQ_LINE_RECEIVING < connection->state)
+        continue;
       if (NULL != line)
       {
         /* Check for empty string, as we might want
@@ -4876,10 +4878,10 @@ MHD_connection_handle_idle (struct MHD_Connection 
*connection)
     case MHD_CONNECTION_URL_RECEIVED:
       line = get_next_header_line (connection,
                                    NULL);
+      if (MHD_CONNECTION_URL_RECEIVED != connection->state)
+        continue;
       if (NULL == line)
       {
-        if (MHD_CONNECTION_URL_RECEIVED != connection->state)
-          continue;
         if (connection->read_closed)
         {
           CONNECTION_CLOSE_ERROR (connection,
@@ -4908,6 +4910,8 @@ MHD_connection_handle_idle (struct MHD_Connection 
*connection)
     case MHD_CONNECTION_HEADER_PART_RECEIVED:
       line = get_next_header_line (connection,
                                    NULL);
+      if (MHD_CONNECTION_HEADER_PART_RECEIVED != connection->state)
+        continue;
       if (NULL == line)
       {
         if (connection->state != MHD_CONNECTION_HEADER_PART_RECEIVED)
@@ -4935,7 +4939,7 @@ MHD_connection_handle_idle (struct MHD_Connection 
*connection)
       continue;
     case MHD_CONNECTION_HEADERS_RECEIVED:
       parse_connection_headers (connection);
-      if (MHD_CONNECTION_CLOSED == connection->state)
+      if (MHD_CONNECTION_HEADERS_RECEIVED != connection->state)
         continue;
       connection->state = MHD_CONNECTION_HEADERS_PROCESSED;
       if (connection->suspended)
@@ -4943,7 +4947,7 @@ MHD_connection_handle_idle (struct MHD_Connection 
*connection)
       continue;
     case MHD_CONNECTION_HEADERS_PROCESSED:
       call_connection_handler (connection);     /* first call */
-      if (MHD_CONNECTION_CLOSED == connection->state)
+      if (MHD_CONNECTION_HEADERS_PROCESSED != connection->state)
         continue;
       if (connection->suspended)
         continue;
@@ -4983,11 +4987,8 @@ MHD_connection_handle_idle (struct MHD_Connection 
*connection)
       if (0 != connection->read_buffer_offset)
       {
         process_request_body (connection);           /* loop call */
-        if (connection->discard_request)
-        {
-          mhd_assert (MHD_CONNECTION_BODY_RECEIVING != connection->state);
+        if (MHD_CONNECTION_BODY_RECEIVING != connection->state)
           continue;
-        }
       }
       if ( (0 == connection->rq.remaining_upload_size) ||
            ( (MHD_SIZE_UNKNOWN == connection->rq.remaining_upload_size) &&
@@ -5007,10 +5008,10 @@ MHD_connection_handle_idle (struct MHD_Connection 
*connection)
     case MHD_CONNECTION_BODY_RECEIVED:
       line = get_next_header_line (connection,
                                    NULL);
+      if (connection->state != MHD_CONNECTION_BODY_RECEIVED)
+        continue;
       if (NULL == line)
       {
-        if (connection->state != MHD_CONNECTION_BODY_RECEIVED)
-          continue;
         if (connection->read_closed)
         {
           CONNECTION_CLOSE_ERROR (connection,
@@ -5041,10 +5042,10 @@ MHD_connection_handle_idle (struct MHD_Connection 
*connection)
     case MHD_CONNECTION_FOOTER_PART_RECEIVED:
       line = get_next_header_line (connection,
                                    NULL);
+      if (connection->state != MHD_CONNECTION_FOOTER_PART_RECEIVED)
+        continue;
       if (NULL == line)
       {
-        if (connection->state != MHD_CONNECTION_FOOTER_PART_RECEIVED)
-          continue;
         if (connection->read_closed)
         {
           CONNECTION_CLOSE_ERROR (connection,
@@ -5073,7 +5074,7 @@ MHD_connection_handle_idle (struct MHD_Connection 
*connection)
       continue;
     case MHD_CONNECTION_FULL_REQ_RECEIVED:
       call_connection_handler (connection);     /* "final" call */
-      if (connection->state == MHD_CONNECTION_CLOSED)
+      if (connection->state != MHD_CONNECTION_FULL_REQ_RECEIVED)
         continue;
       if (NULL == connection->rp.response)
         break;                  /* try again next time */

-- 
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]