]> granicus.if.org Git - apache/commitdiff
Return the proper status and headers when serving a revalidated response.
authorJustin Erenkrantz <jerenkrantz@apache.org>
Tue, 8 Feb 2005 17:56:38 +0000 (17:56 +0000)
committerJustin Erenkrantz <jerenkrantz@apache.org>
Tue, 8 Feb 2005 17:56:38 +0000 (17:56 +0000)
* modules/cache/mod_cache.c
  (cache_save_filter): Load in the cached status and headers; send a flush
  rather than an EOS when the client request is conditional.
* modules/cache/mod_cache.h: Export ap_cache_accept_headers.
* modules/cache/cache_storage.c: Rename accept_headers to
  ap_cache_accept_headers.

git-svn-id: https://svn.apache.org/repos/asf/httpd/httpd/trunk@152680 13f79535-47bb-0310-9956-ffa450edef68

modules/cache/cache_storage.c
modules/cache/mod_cache.c
modules/cache/mod_cache.h

index 695f43866857523a70e282405ef0bae8b4a25b90..ced8d738ee5df76d803e286428757c4a1befb677 100644 (file)
@@ -105,7 +105,7 @@ static int set_cookie_doo_doo(void *v, const char *key, const char *val)
     return 1;
 }
 
-static void accept_headers(cache_handle_t *h, request_rec *r)
+CACHE_DECLARE(void) ap_cache_accept_headers(cache_handle_t *h, request_rec *r)
 {
     apr_table_t *cookie_table;
     const char *v;
@@ -272,7 +272,7 @@ int cache_select_url(request_rec *r, char *url)
             }
 
             /* Okay, this response looks okay.  Merge in our stuff and go. */
-            accept_headers(h, r);
+            ap_cache_accept_headers(h, r);
 
             cache->handle = h;
             return OK;
index 6629d3b259d1bb03b0062e032d26178df25381e6..09c1d5c15353710538879bc4cb03f98053479585 100644 (file)
@@ -532,6 +532,12 @@ static int cache_save_filter(ap_filter_t *f, apr_bucket_brigade *in)
             /* Oh, hey.  It isn't that stale!  Yay! */
             cache->handle = cache->stale_handle;
             info = &cache->handle->cache_obj->info;
+            /* Load in the saved status. */
+            r->status = info->status;
+            /* The cached response will override our err_headers_out. */
+            apr_table_clear(r->err_headers_out);
+            /* Merge in our headers. */
+            ap_cache_accept_headers(cache->handle, r);
             rv = OK;
         }
         else {
@@ -665,7 +671,7 @@ static int cache_save_filter(ap_filter_t *f, apr_bucket_brigade *in)
             /* FIXME: Should we now go and make sure it's really not
              * modified since what the user thought?
              */
-            bkt = apr_bucket_eos_create(bb->bucket_alloc);
+            bkt = apr_bucket_flush_create(bb->bucket_alloc);
             APR_BRIGADE_INSERT_TAIL(bb, bkt);
         }
         else {
index 47bbf73ff9c046f15e089a540c35904e8894651a..076c6e342d8620a866b0b6938b1e8ba6bb330fcd 100644 (file)
@@ -240,6 +240,9 @@ CACHE_DECLARE(apr_time_t) ap_cache_current_age(cache_info *info, const apr_time_
  * @return 0 ==> cache object is stale, 1 ==> cache object is fresh
  */
 CACHE_DECLARE(int) ap_cache_check_freshness(cache_handle_t *h, request_rec *r);
+
+CACHE_DECLARE(void) ap_cache_accept_headers(cache_handle_t *h, request_rec *r);
+
 CACHE_DECLARE(apr_time_t) ap_cache_hex2usec(const char *x);
 CACHE_DECLARE(void) ap_cache_usec2hex(apr_time_t j, char *y);
 CACHE_DECLARE(char *) generate_name(apr_pool_t *p, int dirlevels,