gnunet-svn
[Top][All Lists]
Advanced

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

[libmicrohttpd] 03/07: response: use auto flag for chunked encoding head


From: gnunet
Subject: [libmicrohttpd] 03/07: response: use auto flag for chunked encoding header
Date: Wed, 28 Jul 2021 10:37:02 +0200

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

karlson2k pushed a commit to branch master
in repository libmicrohttpd.

commit 678dcd0931b9d98b7831f224801aaf54ff9596c2
Author: Evgeny Grin (Karlson2k) <k2k@narod.ru>
AuthorDate: Tue Jul 27 17:59:38 2021 +0300

    response: use auto flag for chunked encoding header
---
 src/microhttpd/response.c | 26 +++++++++++++++++++++++---
 1 file changed, 23 insertions(+), 3 deletions(-)

diff --git a/src/microhttpd/response.c b/src/microhttpd/response.c
index f502187f..6e6ed4d3 100644
--- a/src/microhttpd/response.c
+++ b/src/microhttpd/response.c
@@ -468,9 +468,23 @@ MHD_add_response_header (struct MHD_Response *response,
        "chunked" is not allowed.  Note that MHD will set the
        correct transfer encoding if required automatically. */
     /* NOTE: for compressed bodies, use the "Content-encoding" header */
-    if ( (! MHD_str_equal_caseless_ (content, "identity")) &&
-         (! MHD_str_equal_caseless_ (content, "chunked")) )
-      return MHD_NO;
+    if (MHD_str_equal_caseless_ (content, "identity"))
+      return add_response_entry (response,
+                                 MHD_HEADER_KIND,
+                                 header,
+                                 content);
+    else if (MHD_str_equal_caseless_ (content, "chunked"))
+    {
+      if (MHD_NO != add_response_entry (response,
+                                        MHD_HEADER_KIND,
+                                        header,
+                                        content))
+      {
+        response->flags_auto |= MHD_RAF_HAS_TRANS_ENC_CHUNKED;
+        return MHD_YES;
+      }
+    }
+    return MHD_NO;
   }
   if ( (0 == (MHD_RF_INSANITY_HEADER_CONTENT_LENGTH
               & response->flags)) &&
@@ -555,6 +569,12 @@ MHD_del_response_header (struct MHD_Response *response,
       free (pos->header);
       free (pos->value);
       free (pos);
+      if ( (MHD_STATICSTR_LEN_ (MHD_HTTP_HEADER_TRANSFER_ENCODING) ==
+            header_len) &&
+           MHD_str_equal_caseless_bin_n_ (header,
+                                          MHD_HTTP_HEADER_TRANSFER_ENCODING,
+                                          header_len) )
+        response->flags_auto &= ~(MHD_RAF_HAS_TRANS_ENC_CHUNKED);
       return MHD_YES;
     }
     pos = pos->next;

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