From: Justin Erenkrantz Date: Tue, 8 Feb 2005 17:56:38 +0000 (+0000) Subject: Return the proper status and headers when serving a revalidated response. X-Git-Tag: 2.1.3~52 X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=74a70d429a222612c4a8c0a363960830a184d417;p=thirdparty%2Fapache%2Fhttpd.git Return the proper status and headers when serving a revalidated response. * 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 --- diff --git a/modules/cache/cache_storage.c b/modules/cache/cache_storage.c index 695f4386685..ced8d738ee5 100644 --- a/modules/cache/cache_storage.c +++ b/modules/cache/cache_storage.c @@ -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; diff --git a/modules/cache/mod_cache.c b/modules/cache/mod_cache.c index 6629d3b259d..09c1d5c1535 100644 --- a/modules/cache/mod_cache.c +++ b/modules/cache/mod_cache.c @@ -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 { diff --git a/modules/cache/mod_cache.h b/modules/cache/mod_cache.h index 47bbf73ff9c..076c6e342d8 100644 --- a/modules/cache/mod_cache.h +++ b/modules/cache/mod_cache.h @@ -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,