gnunet-svn
[Top][All Lists]
Advanced

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

[libmicrohttpd] 01/02: Transmit error reply to the clients if received b


From: gnunet
Subject: [libmicrohttpd] 01/02: Transmit error reply to the clients if received broken chunked encoding
Date: Sun, 17 Oct 2021 12:57:46 +0200

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

karlson2k pushed a commit to branch master
in repository libmicrohttpd.

commit 21cdab14f8c314dc44a90e3207fba7f4fc3f838c
Author: Evgeny Grin (Karlson2k) <k2k@narod.ru>
AuthorDate: Sun Oct 17 13:51:51 2021 +0300

    Transmit error reply to the clients if received broken chunked encoding
---
 src/microhttpd/connection.c | 27 ++++++++++++++++++---------
 1 file changed, 18 insertions(+), 9 deletions(-)

diff --git a/src/microhttpd/connection.c b/src/microhttpd/connection.c
index da3fc1df..62e21d03 100644
--- a/src/microhttpd/connection.c
+++ b/src/microhttpd/connection.c
@@ -103,6 +103,17 @@
 #define REQUEST_MALFORMED ""
 #endif
 
+/**
+ * Response text used when the request HTTP chunked encoding is
+ * malformed.
+ */
+#ifdef HAVE_MESSAGES
+#define REQUEST_CHUNKED_MALFORMED \
+  "<html><head><title>Request malformed</title></head><body>Your HTTP chunked 
encoding was syntactically incorrect.</body></html>"
+#else
+#define REQUEST_CHUNKED_MALFORMED ""
+#endif
+
 /**
  * Response text used when there is an internal server error.
  *
@@ -3070,10 +3081,9 @@ process_request_body (struct MHD_Connection *connection)
         if (0 == i)
         {
           /* malformed encoding */
-          CONNECTION_CLOSE_ERROR (connection,
-                                  _ ("Received malformed HTTP request " \
-                                     "(bad chunked encoding). " \
-                                     "Closing connection."));
+          transmit_error_response_static (connection,
+                                          MHD_HTTP_BAD_REQUEST,
+                                          REQUEST_CHUNKED_MALFORMED);
           return;
         }
         available -= i;
@@ -3150,10 +3160,9 @@ process_request_body (struct MHD_Connection *connection)
         if (malformed)
         {
           /* malformed encoding */
-          CONNECTION_CLOSE_ERROR (connection,
-                                  _ ("Received malformed HTTP request " \
-                                     "(bad chunked encoding). " \
-                                     "Closing connection."));
+          transmit_error_response_static (connection,
+                                          MHD_HTTP_BAD_REQUEST,
+                                          REQUEST_CHUNKED_MALFORMED);
           return;
         }
         /* skip 2nd part of line feed */
@@ -4383,7 +4392,7 @@ MHD_connection_handle_idle (struct MHD_Connection 
*connection)
       if (0 != connection->read_buffer_offset)
       {
         process_request_body (connection);           /* loop call */
-        if (MHD_CONNECTION_CLOSED == connection->state)
+        if (connection->stop_with_error)
           continue;
       }
       if ( (0 == connection->remaining_upload_size) ||

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