gnunet-svn
[Top][All Lists]
Advanced

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

[libmicrohttpd] branch master updated (a96eaaaa -> 6f48db46)


From: gnunet
Subject: [libmicrohttpd] branch master updated (a96eaaaa -> 6f48db46)
Date: Thu, 19 Aug 2021 19:15:30 +0200

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

karlson2k pushed a change to branch master
in repository libmicrohttpd.

    from a96eaaaa Response flags: clarified functionality, added synonymous 
names
     new dab2db20 microhttpd.h: moved up MHD_VERSION macro
     new 6f48db46 Added response flag to always send "Connection:" header

The 2 revisions listed above as "new" are entirely new to this
repository and will be described in separate emails.  The revisions
listed as "add" were already present in the repository and have only
been added to this reference.


Summary of changes:
 src/include/microhttpd.h    | 38 +++++++++++++++++++++++---------------
 src/microhttpd/connection.c |  6 ++++--
 2 files changed, 27 insertions(+), 17 deletions(-)

diff --git a/src/include/microhttpd.h b/src/include/microhttpd.h
index 1cec6659..d2eaeff3 100644
--- a/src/include/microhttpd.h
+++ b/src/include/microhttpd.h
@@ -88,6 +88,16 @@ extern "C"
 #endif
 #endif
 
+
+/**
+ * Current version of the library in packed BCD form.
+ * @note Version number components are coded as Simple Binary-Coded Decimal
+ * (also called Natural BCD or BCD 8421). While they are hexadecimal numbers,
+ * they are parsed as decimal numbers.
+ * Example: 0x01093001 = 1.9.30-1.
+ */
+#define MHD_VERSION 0x00097310
+
 /* If generic headers don't work on your platform, include headers
    which define 'va_list', 'size_t', 'ssize_t', 'intptr_t',
    'uint16_t', 'uint32_t', 'uint64_t', 'off_t', 'struct sockaddr',
@@ -124,16 +134,6 @@ typedef intptr_t ssize_t;
 #error Cygwin with winsock fd_set is not supported
 #endif
 
-/**
- * Current version of the library in packed BCD form.
- * @note Version number components are coded as Simple Binary-Coded Decimal
- * (also called Natural BCD or BCD 8421). While they are hexadecimal numbers,
- * they are parsed as decimal numbers.
- * Example: 0x01093001 = 1.9.30-1.
- */
-#define MHD_VERSION 0x00097308
-
-
 #ifdef __has_attribute
 #if __has_attribute (flag_enum)
 #define _MHD_FLAGS_ENUM __attribute__((flag_enum))
@@ -3126,12 +3126,12 @@ enum MHD_ResponseFlags
    * does not implement HTTP/1.1 features, but advertises HTTP/1.1 support.
    * @note Available since #MHD_VERSION 0x00097308
    */
-  MHD_RF_HTTP_1_0_COMPATIBLE_STRICT = 1,
+  MHD_RF_HTTP_1_0_COMPATIBLE_STRICT = 1 << 0,
   /**
    * The same as #MHD_RF_HTTP_1_0_COMPATIBLE_STRICT
    * @note Available since #MHD_VERSION 0x00093701
    */
-  MHD_RF_HTTP_VERSION_1_0_ONLY = 1,
+  MHD_RF_HTTP_VERSION_1_0_ONLY = 1 << 0,
 
   /**
    * Only respond in HTTP 1.0-mode.
@@ -3145,19 +3145,27 @@ enum MHD_ResponseFlags
    * as chunked encoding in requests will be supported still).
    * @note Available since #MHD_VERSION 0x00097308
    */
-  MHD_RF_HTTP_1_0_SERVER = 2,
+  MHD_RF_HTTP_1_0_SERVER = 1 << 1,
   /**
    * The same as #MHD_RF_HTTP_1_0_SERVER
    * @note Available since #MHD_VERSION 0x00096000
    */
-  MHD_RF_HTTP_VERSION_1_0_RESPONSE = 2,
+  MHD_RF_HTTP_VERSION_1_0_RESPONSE = 1 << 1,
 
   /**
    * Disable sanity check preventing clients from manually
    * setting the HTTP content length option.
    * @note Available since #MHD_VERSION 0x00096702
    */
-  MHD_RF_INSANITY_HEADER_CONTENT_LENGTH = 4
+  MHD_RF_INSANITY_HEADER_CONTENT_LENGTH = 1 << 2,
+
+  /**
+   * Enable sending of "Connection: keep-alive" header even for
+   * HTTP/1.1 clients when "Keep-Alive" connection is used.
+   * Disabled by default for HTTP/1.1 clients as per RFC.
+   * @note Available since #MHD_VERSION 0x00097310
+   */
+  MHD_RF_SEND_KEEP_ALIVE_HEADER = 1 << 3
 } _MHD_FIXED_FLAGS_ENUM;
 
 
diff --git a/src/microhttpd/connection.c b/src/microhttpd/connection.c
index d8561251..9cdc06f1 100644
--- a/src/microhttpd/connection.c
+++ b/src/microhttpd/connection.c
@@ -1940,7 +1940,8 @@ build_header_response (struct MHD_Connection *connection)
     }
     else if (MHD_CONN_USE_KEEPALIVE == c->keepalive)
     {
-      if (MHD_HTTP_VER_1_0 == c->http_ver)
+      if ((MHD_HTTP_VER_1_0 == c->http_ver) ||
+          (0 != (r->flags | MHD_RF_SEND_KEEP_ALIVE_HEADER)))
       {
         if (! buffer_append_s (buf, &pos, buf_size,
                                MHD_HTTP_HEADER_CONNECTION ": Keep-Alive\r\n"))
@@ -1954,7 +1955,8 @@ build_header_response (struct MHD_Connection *connection)
   if (! add_user_headers (buf, &pos, buf_size, r, MHD_HEADER_KIND,
                           ! c->rp_props.chunked,
                           (MHD_CONN_MUST_CLOSE == c->keepalive),
-                          (MHD_HTTP_VER_1_0 == c->http_ver) &&
+                          ((MHD_HTTP_VER_1_0 == c->http_ver) ||
+                           (0 != (r->flags | MHD_RF_SEND_KEEP_ALIVE_HEADER))) 
&&
                           (MHD_CONN_USE_KEEPALIVE == c->keepalive)))
     return MHD_NO;
 

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