gnunet-svn
[Top][All Lists]
Advanced

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

[libmicrohttpd] 03/04: RFC compliance: use chunked even for non-Keep-Ali


From: gnunet
Subject: [libmicrohttpd] 03/04: RFC compliance: use chunked even for non-Keep-Alive HTTP/1.1 clients
Date: Wed, 18 Aug 2021 11:56:21 +0200

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

karlson2k pushed a commit to branch master
in repository libmicrohttpd.

commit 496900010b80b30eacbf341a95e0ef9b18e055a8
Author: Evgeny Grin (Karlson2k) <k2k@narod.ru>
AuthorDate: Wed Aug 18 12:43:11 2021 +0300

    RFC compliance: use chunked even for non-Keep-Alive HTTP/1.1 clients
---
 src/include/microhttpd.h    |  2 +-
 src/microhttpd/connection.c | 13 ++++++++-----
 2 files changed, 9 insertions(+), 6 deletions(-)

diff --git a/src/include/microhttpd.h b/src/include/microhttpd.h
index 4edd2d0b..d2b63947 100644
--- a/src/include/microhttpd.h
+++ b/src/include/microhttpd.h
@@ -131,7 +131,7 @@ typedef intptr_t ssize_t;
  * they are parsed as decimal numbers.
  * Example: 0x01093001 = 1.9.30-1.
  */
-#define MHD_VERSION 0x00097305
+#define MHD_VERSION 0x00097306
 
 
 #ifdef __has_attribute
diff --git a/src/microhttpd/connection.c b/src/microhttpd/connection.c
index b7505762..bb0bd681 100644
--- a/src/microhttpd/connection.c
+++ b/src/microhttpd/connection.c
@@ -1630,19 +1630,22 @@ setup_reply_properties (struct MHD_Connection 
*connection)
       else if (0 != (r->flags & (MHD_RF_HTTP_VERSION_1_0_ONLY
                                  | MHD_RF_HTTP_VERSION_1_0_RESPONSE)))
         use_chunked = false;
-      /* TODO: Use chunked for HTTP/1.1 non-Keep-Alive */
-      else if (0 != (r->flags_auto & MHD_RAF_HAS_TRANS_ENC_CHUNKED))
-        use_chunked = true;
-      else if (! use_keepalive)
-        use_chunked = false;
       else
+        /* If chunked encoding is supported and allowed, and response size
+         * is unknown, use chunked even for non-Keep-Alive connections.
+         * See https://datatracker.ietf.org/doc/html/rfc7230#section-3.3.3
+         * Also use chunked if it is enforced by application and supported by
+         * the client. */
         use_chunked = true;
     }
     else
       use_chunked = false;
 
     if ( (MHD_SIZE_UNKNOWN == r->total_size) && ! use_chunked)
+    {
+      mhd_assert (! MHD_IS_HTTP_VER_1_1_COMPAT (c->http_ver));
       use_keepalive = false; /* End of the stream is indicated by closure */
+    }
   }
 
   c->rp_props.chunked = use_chunked;

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