]> granicus.if.org Git - apache/commitdiff
ap_meets_conditions() should not be called until all of
authorRoy T. Fielding <fielding@apache.org>
Thu, 12 Feb 2009 18:58:10 +0000 (18:58 +0000)
committerRoy T. Fielding <fielding@apache.org>
Thu, 12 Feb 2009 18:58:10 +0000 (18:58 +0000)
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

modules/cache/mod_file_cache.c
server/core.c

index 9756cc736fbcc7fdc760c3492f90c054987ce195..f24a1125e5d41f142a99aa320b66b049f0144b3c 100644 (file)
@@ -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)
index e10c1410293fa4925b1ef85351446d0dfb38c8bb..5676b6b0f5fbc9499c8acc7c9fc19a273d2d66e0 100644 (file)
@@ -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