summaryrefslogtreecommitdiff
path: root/include
diff options
context:
space:
mode:
authorGraham Leggett <minfrin@apache.org>2020-06-27 23:41:00 +0000
committerGraham Leggett <minfrin@apache.org>2020-06-27 23:41:00 +0000
commit8de97e5fabff6069844cc14f41a4bcb7759d5cdc (patch)
treec301ae85767d05e69653d264bbb4c2c581b0aa21 /include
parent1f6d74d465f2db2cbde89589989469296d8ca385 (diff)
downloadhttpd-8de97e5fabff6069844cc14f41a4bcb7759d5cdc.tar.gz
"[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
Diffstat (limited to 'include')
-rw-r--r--include/ap_mmn.h7
-rw-r--r--include/http_core.h13
-rw-r--r--include/http_protocol.h39
-rw-r--r--include/httpd.h50
4 files changed, 99 insertions, 10 deletions
diff --git a/include/ap_mmn.h b/include/ap_mmn.h
index 7d9f5e279e..fc32a1ea1d 100644
--- a/include/ap_mmn.h
+++ b/include/ap_mmn.h
@@ -636,6 +636,11 @@
* 20200420.5 (2.5.1-dev) Add pre_translate_name hook
* 20200420.6 (2.5.1-dev) Add map_encoded_one and map_encoded_all bits to
* proxy_server_conf
+ * 20200420.7 (2.5.1-dev) Add struct etag_rec, ap_make_etag_ex(),
+ * ap_set_etag_fd(). Add typedef ap_request_bnotes_t,
+ * macros AP_REQUEST_GET_BNOTE, AP_REQUEST_SET_BNOTE,
+ * AP_REQUEST_STRONG_ETAG, AP_REQUEST_IS_STRONG_ETAG.
+ * Add bnotes to request_rec.
*/
#define MODULE_MAGIC_COOKIE 0x41503235UL /* "AP25" */
@@ -643,7 +648,7 @@
#ifndef MODULE_MAGIC_NUMBER_MAJOR
#define MODULE_MAGIC_NUMBER_MAJOR 20200420
#endif
-#define MODULE_MAGIC_NUMBER_MINOR 6 /* 0...n */
+#define MODULE_MAGIC_NUMBER_MINOR 7 /* 0...n */
/**
* Determine if the server's current MODULE_MAGIC_NUMBER is at least a
diff --git a/include/http_core.h b/include/http_core.h
index a64a1888d6..2bcd713560 100644
--- a/include/http_core.h
+++ b/include/http_core.h
@@ -489,12 +489,13 @@ typedef unsigned int overrides_t;
*/
typedef unsigned long etag_components_t;
-#define ETAG_UNSET 0
-#define ETAG_NONE (1 << 0)
-#define ETAG_MTIME (1 << 1)
-#define ETAG_INODE (1 << 2)
-#define ETAG_SIZE (1 << 3)
-#define ETAG_ALL (ETAG_MTIME | ETAG_INODE | ETAG_SIZE)
+#define ETAG_UNSET 0
+#define ETAG_NONE (1 << 0)
+#define ETAG_MTIME (1 << 1)
+#define ETAG_INODE (1 << 2)
+#define ETAG_SIZE (1 << 3)
+#define ETAG_DIGEST (1 << 4)
+#define ETAG_ALL (ETAG_MTIME | ETAG_INODE | ETAG_SIZE)
/* This is the default value used */
#define ETAG_BACKWARD (ETAG_MTIME | ETAG_SIZE)
diff --git a/include/http_protocol.h b/include/http_protocol.h
index b7953d0a6b..9c9cb952b2 100644
--- a/include/http_protocol.h
+++ b/include/http_protocol.h
@@ -166,6 +166,27 @@ AP_DECLARE(const char *) ap_make_content_type(request_rec *r,
*/
AP_DECLARE(void) ap_setup_make_content_type(apr_pool_t *pool);
+/** A structure with the ingredients for a file based etag */
+typedef struct etag_rec etag_rec;
+
+/**
+ * @brief A structure with the ingredients for a file based etag
+ */
+struct etag_rec {
+ /** Optional vary list validator */
+ const char *vlist_validator;
+ /** Time when the request started */
+ apr_time_t request_time;
+ /** finfo.protection (st_mode) set to zero if no such file */
+ apr_finfo_t *finfo;
+ /** File pathname used when generating a digest */
+ const char *pathname;
+ /** File descriptor used when generating a digest */
+ apr_file_t *fd;
+ /** Force a non-digest etag to be weak */
+ int force_weak;
+};
+
/**
* Construct an entity tag from the resource information. If it's a real
* file, build in some of the file characteristics.
@@ -177,12 +198,27 @@ AP_DECLARE(void) ap_setup_make_content_type(apr_pool_t *pool);
AP_DECLARE(char *) ap_make_etag(request_rec *r, int force_weak);
/**
+ * Construct an entity tag from information provided in the etag_rec
+ * structure.
+ * @param r The current request
+ * @param er The etag record, containing ingredients for the etag.
+ */
+AP_DECLARE(char *) ap_make_etag_ex(request_rec *r, etag_rec *er);
+
+/**
* Set the E-tag outgoing header
* @param r The current request
*/
AP_DECLARE(void) ap_set_etag(request_rec *r);
/**
+ * Set the E-tag outgoing header, with the option of forcing a strong ETag.
+ * @param r The current request
+ * @param fd The file descriptor
+ */
+AP_DECLARE(void) ap_set_etag_fd(request_rec *r, apr_file_t *fd);
+
+/**
* Set the last modified time for the file being sent
* @param r The current request
*/
@@ -762,7 +798,7 @@ AP_DECLARE_HOOK(const char *,http_scheme,(const request_rec *r))
AP_DECLARE_HOOK(apr_port_t,default_port,(const request_rec *r))
-#define AP_PROTOCOL_HTTP1 "http/1.1"
+#define AP_PROTOCOL_HTTP1 "http/1.1"
/**
* Determine the list of protocols available for a connection/request. This may
@@ -1011,6 +1047,7 @@ AP_DECLARE(void) ap_finalize_sub_req_protocol(request_rec *sub_r);
*/
AP_DECLARE(void) ap_send_interim_response(request_rec *r, int send_headers);
+
#ifdef __cplusplus
}
#endif
diff --git a/include/httpd.h b/include/httpd.h
index ad38f2c927..5e4c036d8a 100644
--- a/include/httpd.h
+++ b/include/httpd.h
@@ -645,8 +645,6 @@ typedef apr_uint64_t ap_method_mask_t;
* The method mask bit to shift for anding with a bitmask.
*/
#define AP_METHOD_BIT ((ap_method_mask_t)1)
-/** @} */
-
/** @see ap_method_list_t */
typedef struct ap_method_list_t ap_method_list_t;
@@ -664,6 +662,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
@@ -1097,6 +1138,11 @@ struct request_rec {
* TODO: compact elsewhere
*/
unsigned int flushed:1;
+ /** 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;
};
/**