gnunet-svn
[Top][All Lists]
Advanced

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

[libmicrohttpd] 03/05: connection: refuse requests with unsupported Tran


From: gnunet
Subject: [libmicrohttpd] 03/05: connection: refuse requests with unsupported Transfer-Encoding
Date: Sun, 06 Nov 2022 13:10:11 +0100

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

karlson2k pushed a commit to branch master
in repository libmicrohttpd.

commit 377e2cbd523323e45ece928aee8b6666f2e46f55
Author: Evgeny Grin (Karlson2k) <k2k@narod.ru>
AuthorDate: Fri Nov 4 15:50:23 2022 +0300

    connection: refuse requests with unsupported Transfer-Encoding
    
    The end of the request body (context) cannot be determined if
    Transfer-Encoding is not supported.
---
 src/microhttpd/connection.c | 25 ++++++++++++++++++++++---
 1 file changed, 22 insertions(+), 3 deletions(-)

diff --git a/src/microhttpd/connection.c b/src/microhttpd/connection.c
index 89955e84..704d6bcf 100644
--- a/src/microhttpd/connection.c
+++ b/src/microhttpd/connection.c
@@ -89,6 +89,19 @@
 #define REQUEST_LACKS_HOST ""
 #endif
 
+/**
+ * Response text used when the request has unsupported "Transfer-Enconding:".
+ */
+#ifdef HAVE_MESSAGES
+#define REQUEST_UNSUPPORTED_TR_ENCODING \
+  "<html>" \
+  "<head><title>Unsupported Transfer-Encoding</title></head>" \
+  "<body>The Transfer-Encoding used in request is not supported.</body>" \
+  "</html>"
+#else
+#define REQUEST_UNSUPPORTED_TR_ENCODING ""
+#endif
+
 /**
  * Response text used when the request (http header) is
  * malformed.
@@ -3975,10 +3988,16 @@ parse_connection_headers (struct MHD_Connection 
*connection)
                                      &enc,
                                      NULL))
   {
+    if (! MHD_str_equal_caseless_ (enc,
+                                   "chunked"))
+    {
+      transmit_error_response_static (connection,
+                                      MHD_HTTP_BAD_REQUEST,
+                                      REQUEST_UNSUPPORTED_TR_ENCODING);
+      return;
+    }
+    connection->rq.have_chunked_upload = true;
     connection->rq.remaining_upload_size = MHD_SIZE_UNKNOWN;
-    if (MHD_str_equal_caseless_ (enc,
-                                 "chunked"))
-      connection->rq.have_chunked_upload = true;
   }
   else
   {

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