From ccc76d4e43aff64df243280f8526dc7de230a4ae Mon Sep 17 00:00:00 2001 From: Stefan Fritsch Date: Tue, 8 Nov 2011 03:06:08 +0000 Subject: [PATCH] Change default FileETag to be "size mtime", i.e. remove the inode. Adjust the etag generation in mod_dav_fs to the new default. PR 49623. git-svn-id: https://svn.apache.org/repos/asf/httpd/httpd/trunk@1199086 13f79535-47bb-0310-9956-ffa450edef68 --- CHANGES | 3 +++ docs/manual/mod/core.xml | 6 ++++-- docs/manual/upgrading.xml | 3 +++ include/http_core.h | 3 ++- modules/dav/fs/repos.c | 4 ++-- 5 files changed, 14 insertions(+), 5 deletions(-) diff --git a/CHANGES b/CHANGES index c90cb75bdf..6989966d88 100644 --- a/CHANGES +++ b/CHANGES @@ -16,6 +16,9 @@ Changes with Apache 2.3.15 core: Fix integer overflow in ap_pregsub. This can be triggered e.g. with mod_setenvif via a malicious .htaccess. [Stefan Fritsch] + *) core, mod_dav_fs: Change default ETag to be "size mtime", i.e. remove + the inode. PR 49623. [Stefan Fritsch] + *) mod_lua: Expose SSL variables via r:ssl_var_lookup(). [Eric Covener] *) mod_lua: LuaHook{AccessChecker,AuthChecker,CheckUserID,TranslateName} diff --git a/docs/manual/mod/core.xml b/docs/manual/mod/core.xml index 465efa3204..1469efbe85 100644 --- a/docs/manual/mod/core.xml +++ b/docs/manual/mod/core.xml @@ -1532,11 +1532,13 @@ request File attributes used to create the ETag HTTP response header for static files FileETag component ... -FileETag INode MTime Size +FileETag MTime Size server configvirtual host directory.htaccess FileInfo +The default used to be "INode MTime Size" in 2.3.14 and +earlier.

@@ -1579,7 +1581,7 @@ HTTP response header for static files Warning Do not change the default for directories or locations that have WebDAV enabled and use mod_dav_fs as a storage provider. - mod_dav_fs uses INode MTime Size + mod_dav_fs uses MTime Size as a fixed format for ETag comparisons on conditional requests. These conditional requests will break if the ETag format is changed via FileETag. diff --git a/docs/manual/upgrading.xml b/docs/manual/upgrading.xml index e0d42f61e0..e7fff87970 100644 --- a/docs/manual/upgrading.xml +++ b/docs/manual/upgrading.xml @@ -188,6 +188,9 @@

  • EnableSendfile now defaults to Off.
  • +
  • FileETag now + defaults to "MTime Size" (without INode).
  • +
  • mod_log_config: ${cookie}C matches whole cookie names. Previously any substring would diff --git a/include/http_core.h b/include/http_core.h index fa214af976..a6be6fb883 100644 --- a/include/http_core.h +++ b/include/http_core.h @@ -461,8 +461,9 @@ typedef unsigned long etag_components_t; #define ETAG_MTIME (1 << 1) #define ETAG_INODE (1 << 2) #define ETAG_SIZE (1 << 3) -#define ETAG_BACKWARD (ETAG_MTIME | ETAG_INODE | ETAG_SIZE) #define ETAG_ALL (ETAG_MTIME | ETAG_INODE | ETAG_SIZE) +/* This is the default value used */ +#define ETAG_BACKWARD (ETAG_MTIME | ETAG_SIZE) /** * @brief Server Signature Enumeration diff --git a/modules/dav/fs/repos.c b/modules/dav/fs/repos.c index 40395ca87e..6c4c44b1fd 100644 --- a/modules/dav/fs/repos.c +++ b/modules/dav/fs/repos.c @@ -1859,14 +1859,14 @@ static dav_error * dav_fs_walk(const dav_walk_params *params, int depth, static const char *dav_fs_getetag(const dav_resource *resource) { dav_resource_private *ctx = resource->info; + /* XXX: This should really honor the FileETag setting */ if (!resource->exists) return apr_pstrdup(ctx->pool, ""); if (ctx->finfo.filetype != APR_NOFILE) { return apr_psprintf(ctx->pool, "\"%" APR_UINT64_T_HEX_FMT "-%" - APR_UINT64_T_HEX_FMT "-%" APR_UINT64_T_HEX_FMT "\"", - (apr_uint64_t) ctx->finfo.inode, + APR_UINT64_T_HEX_FMT "\"", (apr_uint64_t) ctx->finfo.size, (apr_uint64_t) ctx->finfo.mtime); } -- 2.40.0