Index: modules/http/http_etag.c =================================================================== --- modules/http/http_etag.c (revision 912611) +++ modules/http/http_etag.c (working copy) @@ -94,13 +94,8 @@ * the content-length (i.e. includes), it just has to be unique * for the file. * - * If the request was made within a second of the last-modified date, - * we send a weak tag instead of a strong one, since it could - * be modified again later in the second, and the validation - * would be incorrect. */ - if ((r->request_time - r->mtime > (1 * APR_USEC_PER_SEC)) && - !force_weak) { + if (!force_weak) { weak = NULL; weak_len = 0; } Index: modules/dav/main/mod_dav.c =================================================================== --- modules/dav/main/mod_dav.c (revision 912611) +++ modules/dav/main/mod_dav.c (working copy) @@ -81,6 +81,7 @@ const char *dir; int locktimeout; int allow_depthinfinity; + int etag_response; } dav_dir_conf; @@ -197,6 +198,7 @@ newconf->dir = DAV_INHERIT_VALUE(parent, child, dir); newconf->allow_depthinfinity = DAV_INHERIT_VALUE(parent, child, allow_depthinfinity); + newconf->etag_response = DAV_INHERIT_VALUE(parent, child, etag_response); return newconf; } @@ -289,6 +291,18 @@ } /* + * Command handler for the DAVETagResponse directive, which is FLAG. + */ +static const char *dav_cmd_etag_response(cmd_parms *cmd, void *config, + int arg) +{ + dav_dir_conf *conf = (dav_dir_conf *)config; + + conf->etag_response = arg; + return NULL; +} + +/* * Command handler for DAVMinTimeout directive, which is TAKE1 */ static const char *dav_cmd_davmintimeout(cmd_parms *cmd, void *config, @@ -609,11 +623,25 @@ int replaced) { const char *body; + dav_dir_conf *conf; if (locn == NULL) { locn = r->uri; } + /* ### insert an ETag header? see HTTP/1.1 S10.2.2 */ + conf = ap_get_module_config(r->per_dir_config, &dav_module); + + /* added ETag response ... vlv disabled as well ! */ + if (conf->etag_response) { + char *vlv = r->vlist_validator; + r->vlist_validator = NULL; + apr_stat(&r->finfo, r->filename, APR_FINFO_MIN, r->pool); + r->mtime = r->finfo.mtime; + ap_set_etag(r); + r->vlist_validator = vlv; + } + /* did the target resource already exist? */ if (replaced) { /* Apache will supply a default message */ @@ -626,8 +654,6 @@ /* Convert locn to an absolute URI, and return in Location header */ apr_table_setn(r->headers_out, "Location", ap_construct_url(r->pool, locn, r)); - /* ### insert an ETag header? see HTTP/1.1 S10.2.2 */ - /* Apache doesn't allow us to set a variable body for HTTP_CREATED, so * we must manufacture the entire response. */ body = apr_psprintf(r->pool, "%s %s has been created.", @@ -4863,6 +4889,11 @@ ACCESS_CONF|RSRC_CONF, "allow Depth infinity PROPFIND requests"), + /* per directory/location, or per server */ + AP_INIT_FLAG("DAVETagResponse", dav_cmd_etag_response, NULL, + ACCESS_CONF|RSRC_CONF, + "response with ETag for dav_created"), + { NULL } }; Index: modules/dav/fs/repos.c =================================================================== --- modules/dav/fs/repos.c (revision 912611) +++ modules/dav/fs/repos.c (working copy) @@ -1840,20 +1840,15 @@ static const char *dav_fs_getetag(const dav_resource *resource) { dav_resource_private *ctx = resource->info; + request_rec *r = ctx->r; if (!resource->exists) return apr_pstrdup(ctx->pool, ""); - if (ctx->finfo.filetype != 0) { - 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) ctx->finfo.size, - (apr_uint64_t) ctx->finfo.mtime); - } + r->mtime = ctx->finfo.mtime; + r->finfo = ctx->finfo; - return apr_psprintf(ctx->pool, "\"%" APR_UINT64_T_HEX_FMT "\"", - (apr_uint64_t) ctx->finfo.mtime); + return ap_make_etag(r, 0); } static const dav_hooks_repository dav_hooks_repository_fs =