Patial backport of:

From 8de97e5fabff6069844cc14f41a4bcb7759d5cdc Mon Sep 17 00:00:00 2001
From: Graham Leggett <minfrin@apache.org>
Date: Sat, 27 Jun 2020 23:41:00 +0000
Subject: [PATCH] "[mod_dav_fs etag handling] should really honor the FileETag
 setting". - It now does. - Add "Digest" to FileETag directive, allowing a
 strong ETag to be   generated using a file digest. - Add ap_make_etag_ex()
 and ap_set_etag_fd() to allow full control over   ETag generation. - Add
 concept of "binary notes" to request_rec, allowing packed bit flags   to be
 added to a request. - First binary note - AP_REQUEST_STRONG_ETAG - allows
 modules to force   the ETag to a strong ETag to comply with RFC requirements,
 such as those   mandated by various WebDAV extensions.

git-svn-id: https://svn.apache.org/repos/asf/httpd/httpd/trunk@1879285 13f79535-47bb-0310-9956-ffa450edef68
---
 CHANGES                   |  13 ++
 docs/manual/mod/core.xml  |  23 ++--
 include/ap_mmn.h          |   7 +-
 include/http_core.h       |  13 +-
 include/http_protocol.h   |  39 +++++-
 include/httpd.h           |  50 +++++++-
 modules/dav/fs/repos.c    |  27 ++--
 modules/test/mod_dialup.c |   2 +-
 server/core.c             |   5 +-
 server/util_etag.c        | 257 ++++++++++++++++++++++++++------------
 10 files changed, 319 insertions(+), 117 deletions(-)

#diff --git a/CHANGES b/CHANGES
#index 2ef98d168d1..ae5c7e715fc 100644
#--- a/CHANGES
#+++ b/CHANGES
#@@ -1,6 +1,19 @@
#                                                          -*- coding: utf-8 -*-
# Changes with Apache 2.5.1
# 
#+  *) "[mod_dav_fs etag handling] should really honor the FileETag setting".
#+     - It now does.
#+     - Add "Digest" to FileETag directive, allowing a strong ETag to be
#+       generated using a file digest.
#+     - Add ap_make_etag_ex() and ap_set_etag_fd() to allow full control over
#+       ETag generation.
#+     - Add concept of "binary notes" to request_rec, allowing packed bit flags
#+       to be added to a request.
#+     - First binary note - AP_REQUEST_STRONG_ETAG - allows modules to force
#+       the ETag to a strong ETag to comply with RFC requirements, such as those
#+       mandated by various WebDAV extensions.
#+     [Graham Leggett]
#+
#   *) mod_ssl: Fix a race condition and possible crash when using a proxy client
#      certificate (SSLProxyMachineCertificateFile).
#      [Armin Abfalterer <a.abfalterer gmail.com>]
Index: apache2-2.4.29/include/httpd.h
===================================================================
--- apache2-2.4.29.orig/include/httpd.h
+++ apache2-2.4.29/include/httpd.h
@@ -645,6 +645,49 @@ struct ap_method_list_t {
     /** the array used for extension methods */
     apr_array_header_t *method_list;
 };
+/** @} */
+
+/**
+ * @defgroup bnotes Binary notes recognized by the server
+ * @ingroup APACHE_CORE_DAEMON
+ * @{
+ *
+ * @brief Binary notes recognized by the server.
+ */
+
+/**
+ * The type used for request binary notes.
+ */
+typedef apr_uint64_t ap_request_bnotes_t;
+
+/**
+ * These constants represent bitmasks for notes associated with this
+ * request. There are space for 64 bits in the apr_uint64_t.
+ *
+ */
+#define AP_REQUEST_STRONG_ETAG 1 >> 0
+
+/**
+ * This is a convenience macro to ease with getting specific request
+ * binary notes.
+ */
+#define AP_REQUEST_GET_BNOTE(r, mask) \
+    ((mask) & ((r)->bnotes))
+
+/**
+ * This is a convenience macro to ease with setting specific request
+ * binary notes.
+ */
+#define AP_REQUEST_SET_BNOTE(r, mask, val) \
+    (r)->bnotes = (((r)->bnotes & ~(mask)) | (val))
+
+/**
+ * Returns true if the strong etag flag is set for this request.
+ */
+#define AP_REQUEST_IS_STRONG_ETAG(r) \
+        AP_REQUEST_GET_BNOTE((r), AP_REQUEST_STRONG_ETAG)
+/** @} */
+
 
 /**
  * @defgroup module_magic Module Magic mime types
@@ -1060,6 +1103,11 @@ struct request_rec {
      *  1 yes/success
      */
     int double_reverse;
+    /** Request flags associated with this request. Use
+     * AP_REQUEST_GET_FLAGS() and AP_REQUEST_SET_FLAGS() to access
+     * the elements of this field.
+     */
+    ap_request_bnotes_t bnotes;
 };
 
 /**
