From: Roy T. Fielding Date: Thu, 12 Feb 2009 18:58:10 +0000 (+0000) Subject: ap_meets_conditions() should not be called until all of X-Git-Tag: 2.3.2~53 X-Git-Url: https://granicus.if.org/sourcecode?a=commitdiff_plain;h=ad2b92fe05f42e89e36e9ee0263ce070ee0c639f;p=apache ap_meets_conditions() should not be called until all of the known content metadata has been set, so that said metadata can be included in the condition tests and in a 304 response. git-svn-id: https://svn.apache.org/repos/asf/httpd/httpd/trunk@743837 13f79535-47bb-0310-9956-ffa450edef68 --- diff --git a/modules/cache/mod_file_cache.c b/modules/cache/mod_file_cache.c index 9756cc736f..f24a1125e5 100644 --- a/modules/cache/mod_file_cache.c +++ b/modules/cache/mod_file_cache.c @@ -358,17 +358,17 @@ static int file_cache_handler(request_rec *r) apr_table_setn(r->headers_out, "Last-Modified", datestr); } - ap_set_etag(r); - if ((errstatus = ap_meets_conditions(r)) != OK) { - return errstatus; - } - /* ap_set_content_length() always converts the same number and never * returns an error. Accelerate it. */ r->clength = match->finfo.size; apr_table_setn(r->headers_out, "Content-Length", match->sizestr); + ap_set_etag(r); + if ((errstatus = ap_meets_conditions(r)) != OK) { + return errstatus; + } + /* Call appropriate handler */ if (!r->header_only) { if (match->is_mmapped == TRUE) diff --git a/server/core.c b/server/core.c index e10c141029..5676b6b0f5 100644 --- a/server/core.c +++ b/server/core.c @@ -3632,6 +3632,10 @@ static int default_handler(request_rec *r) ap_set_etag(r); apr_table_setn(r->headers_out, "Accept-Ranges", "bytes"); ap_set_content_length(r, r->finfo.size); + if (bld_content_md5) { + apr_table_setn(r->headers_out, "Content-MD5", + ap_md5digest(r->pool, fd)); + } bb = apr_brigade_create(r->pool, c->bucket_alloc); @@ -3640,11 +3644,6 @@ static int default_handler(request_rec *r) r->status = errstatus; } else { - if (bld_content_md5) { - apr_table_setn(r->headers_out, "Content-MD5", - ap_md5digest(r->pool, fd)); - } - e = apr_brigade_insert_file(bb, fd, 0, r->finfo.size, r->pool); #if APR_HAS_MMAP