Commit Graph

144 Commits

Author SHA1 Message Date
bf69cf6369 Make sure we remove the cache lock consistently as soon as we've started
down the error path, so that we don't delay the next attempt to cache.


git-svn-id: https://svn.apache.org/repos/asf/httpd/httpd/trunk@1021944 13f79535-47bb-0310-9956-ffa450edef68
2010-10-12 22:43:49 +00:00
d1da525e05 Restore the apr_brigade_insert_file() call to within recall_body(), as the
function does more than add a single file bucket. Pass an empty brigade
to recall_body(), and prepend the result to the existing output brigade,
the next bucket being eos.


git-svn-id: https://svn.apache.org/repos/asf/httpd/httpd/trunk@1021917 13f79535-47bb-0310-9956-ffa450edef68
2010-10-12 20:43:51 +00:00
0f267cd6ad mod_cache: Optionally serve stale data when a revalidation returns a
5xx response, controlled by the CacheStaleOnError directive.


git-svn-id: https://svn.apache.org/repos/asf/httpd/httpd/trunk@1021546 13f79535-47bb-0310-9956-ffa450edef68
2010-10-11 23:32:56 +00:00
97b03cc25c Use the more popular spelling variant.
git-svn-id: https://svn.apache.org/repos/asf/httpd/httpd/trunk@1021544 13f79535-47bb-0310-9956-ffa450edef68
2010-10-11 23:23:57 +00:00
16274f6ad6 Fix the lookup of the per-directory cache config, we were looking up the
per-server config instead.


git-svn-id: https://svn.apache.org/repos/asf/httpd/httpd/trunk@1021543 13f79535-47bb-0310-9956-ffa450edef68
2010-10-11 23:21:14 +00:00
7e03f9e8c0 Remove the attempt to pass the cache key into the lock functions, use
cache->key instead for this. Fixes a segfault caused when cache->key
was populated, but the passed in key was not.


git-svn-id: https://svn.apache.org/repos/asf/httpd/httpd/trunk@1004220 13f79535-47bb-0310-9956-ffa450edef68
2010-10-04 12:46:06 +00:00
d29eacb478 mod_cache: Allow control over the base URL of reverse proxied requests
using the CacheKeyBaseURL directive, so that the cache key can be
calculated from the endpoint URL instead of the server URL.


git-svn-id: https://svn.apache.org/repos/asf/httpd/httpd/trunk@1003963 13f79535-47bb-0310-9956-ffa450edef68
2010-10-03 13:23:39 +00:00
b9ba2169a9 Realign the cache_quick_handler() and cache_handler() to behave identically
to the default_handler() when it comes to reacting to errors when writing
to the filter stack. Previously the error message implied the cache had
failed, when in reality, any part of the filter stack may have returned an
error.


git-svn-id: https://svn.apache.org/repos/asf/httpd/httpd/trunk@1003913 13f79535-47bb-0310-9956-ffa450edef68
2010-10-02 23:17:47 +00:00
422e4393e1 Remove FIXMEs, they have been fixed.
git-svn-id: https://svn.apache.org/repos/asf/httpd/httpd/trunk@1003905 13f79535-47bb-0310-9956-ffa450edef68
2010-10-02 22:20:07 +00:00
5ec95ec848 mod_cache: CacheLastModifiedFactor, CacheStoreNoStore, CacheStorePrivate,
CacheStoreExpired, CacheIgnoreNoLastMod, CacheDefaultExpire, 
CacheMinExpire and CacheMaxExpire can be set per directory/location.


git-svn-id: https://svn.apache.org/repos/asf/httpd/httpd/trunk@1003882 13f79535-47bb-0310-9956-ffa450edef68
2010-10-02 20:57:38 +00:00
44b825b72c mod_cache: Support the caching of HEAD requests.
git-svn-id: https://svn.apache.org/repos/asf/httpd/httpd/trunk@1003331 13f79535-47bb-0310-9956-ffa450edef68
2010-09-30 23:25:15 +00:00
5059403b56 mod_cache: Make sure that we never allow a 304 Not Modified response
that we asked for to leak to the client should the 304 response be
uncacheable. PR45341


git-svn-id: https://svn.apache.org/repos/asf/httpd/httpd/trunk@1001884 13f79535-47bb-0310-9956-ffa450edef68
2010-09-27 19:28:40 +00:00
61b7c8574b mod_cache: Add the cache_status hook to register the final cache
decision hit/miss/revalidate. Add optional support for an X-Cache
and/or an X-Cache-Detail header to add the cache status to the
response. PR48241


git-svn-id: https://svn.apache.org/repos/asf/httpd/httpd/trunk@1001639 13f79535-47bb-0310-9956-ffa450edef68
2010-09-27 09:20:40 +00:00
8a91dc4dbe Make ap_cache_accept_headers, ap_cache_accept_headers, ap_cache_try_lock and
ap_cache_check_freshness private.


git-svn-id: https://svn.apache.org/repos/asf/httpd/httpd/trunk@1000187 13f79535-47bb-0310-9956-ffa450edef68
2010-09-22 20:28:11 +00:00
502a305b1d Remove the MOD_CACHE_REQUEST_REC hack, and pass the cache_request_rec
structure through mod_cache's function parameters in the usual way.


git-svn-id: https://svn.apache.org/repos/asf/httpd/httpd/trunk@1000152 13f79535-47bb-0310-9956-ffa450edef68
2010-09-22 19:35:26 +00:00
9baaf4e800 Revert breakage in 2.2.4 introduced in r450055, by offering a CacheStoreExpired
directive to allow the user to override this questionable change.

git-svn-id: https://svn.apache.org/repos/asf/httpd/httpd/trunk@1000106 13f79535-47bb-0310-9956-ffa450edef68
2010-09-22 17:54:39 +00:00
c8de96f357 Move private cache_* declarations out of the public mod_cache.h file.
git-svn-id: https://svn.apache.org/repos/asf/httpd/httpd/trunk@999681 13f79535-47bb-0310-9956-ffa450edef68
2010-09-21 22:55:22 +00:00
d8fc5d96a8 mod_cache: Give the cache provider the opportunity to choose to cache
or not cache based on the buckets present in the brigade, such as the
presence of a FILE bucket.


git-svn-id: https://svn.apache.org/repos/asf/httpd/httpd/trunk@999630 13f79535-47bb-0310-9956-ffa450edef68
2010-09-21 20:43:44 +00:00
ca9d2ae938 mod_cache: Add a discrete commit_entity() provider function within the
mod_cache provider interface which is called to indicate to the
provider that caching is complete, giving the provider the opportunity
to commit temporary files permanently to the cache in an atomic
fashion. Move all "rename" functionality of temporary files to permanent
files within mod_disk_cache from ad hoc locations in the code to the
commit_entity() function. Instead of reusing the same variables for
temporary file handling in mod_disk_cache, introduce separate discrete
structures for each of the three cache file types, the headers file,
vary file and data file, so that the atomic rename of all three file
types within commit_entity() becomes possible. Replace the inconsistent
use of error cleanups with a formal set of pool cleanups attached to
a subpool, which is destroyed on error.


git-svn-id: https://svn.apache.org/repos/asf/httpd/httpd/trunk@997545 13f79535-47bb-0310-9956-ffa450edef68
2010-09-16 00:05:14 +00:00
665426645e mod_cache: Change the signature of the store_body() provider function
within the mod_cache provider interface to support an "in" brigade
and an "out" brigade instead of just a single input brigade. This
gives a cache provider the option to consume only part of the brigade
passed to it, rather than the whole brigade as was required before.
This fixes an out of memory and a request timeout condition that would
occur when the original document was a large file. Update the
mod_disk_cache provider implementation to take into account the new API.
Introduce CacheReadSize and CacheReadTime directives to mod_disk_cache
to control the amount of data to attempt to cache before sending the
data on to the client in the "out" brigade.


git-svn-id: https://svn.apache.org/repos/asf/httpd/httpd/trunk@996395 13f79535-47bb-0310-9956-ffa450edef68
2010-09-12 23:16:49 +00:00
5604942f8f remove unused variables
git-svn-id: https://svn.apache.org/repos/asf/httpd/httpd/trunk@992809 13f79535-47bb-0310-9956-ffa450edef68
2010-09-05 15:56:10 +00:00
8991d4795f mod_cache: Use a proper filter context to hold filter data instead
of misusing the per-request configuration. Fixes a segfault on trunk
when the normal handler is used.


git-svn-id: https://svn.apache.org/repos/asf/httpd/httpd/trunk@992614 13f79535-47bb-0310-9956-ffa450edef68
2010-09-04 14:42:30 +00:00
aa576071af - Remove a load of unused variables (or variables that are set but never read).
- Move some declarations into the correct #ifdef scope.

I couldn't compile/test netware, but the changes look obvious enough.


git-svn-id: https://svn.apache.org/repos/asf/httpd/httpd/trunk@982016 13f79535-47bb-0310-9956-ffa450edef68
2010-08-03 19:45:21 +00:00
a71d310a23 mod_cache: Explicitly allow cache implementations to cache a 206 Partial
Response if they so choose to do so. Previously an attempt to cache a 206
was arbitrarily allowed if the response contained an Expires or
Cache-Control header, and arbitrarily denied if both headers were missing.


git-svn-id: https://svn.apache.org/repos/asf/httpd/httpd/trunk@952823 13f79535-47bb-0310-9956-ffa450edef68
2010-06-08 21:13:06 +00:00
ebb62867fb Use the new APLOG_USE_MODULE/AP_DECLARE_MODULE macros everywhere to take
advantage of per-module loglevels


git-svn-id: https://svn.apache.org/repos/asf/httpd/httpd/trunk@951895 13f79535-47bb-0310-9956-ffa450edef68
2010-06-06 16:59:50 +00:00
2e958275d9 Fix a bug where if the cache quick handler is switched off, and the CACHE
filter is manually added by the admin, but caching has not been enabled for
the URL space, an attempt is made to remove the CACHE_SAVE filter instead
of the CACHE filter. This fix makes the code work like the comment above
the code, the comment being correct.


git-svn-id: https://svn.apache.org/repos/asf/httpd/httpd/trunk@951220 13f79535-47bb-0310-9956-ffa450edef68
2010-06-04 00:09:51 +00:00
8fa54a82f4 * Do NOT cache 206 responses in any case since we don't (yet) know how to
cache partial responses. Fixes regression of r724093.

PR: 49113


git-svn-id: https://svn.apache.org/repos/asf/httpd/httpd/trunk@933919 13f79535-47bb-0310-9956-ffa450edef68
2010-04-14 12:00:11 +00:00
93b1a9ca24 use ap_strchr_c to protect const-ness of input string
(and thus quiet gcc in maintainer mode)


git-svn-id: https://svn.apache.org/repos/asf/httpd/httpd/trunk@832177 13f79535-47bb-0310-9956-ffa450edef68
2009-11-02 23:03:14 +00:00
17df062a0a mod_cache: add Cache-control: s-maxage to cacheability decisions per RFC 2616.
git-svn-id: https://svn.apache.org/repos/asf/httpd/httpd/trunk@823536 13f79535-47bb-0310-9956-ffa450edef68
2009-10-09 12:58:09 +00:00
ae50b75b92 mod_cache: Teach CacheEnable and CacheDisable to work from within a
Location section, in line with how ProxyPass works.


git-svn-id: https://svn.apache.org/repos/asf/httpd/httpd/trunk@821993 13f79535-47bb-0310-9956-ffa450edef68
2009-10-05 20:27:19 +00:00
29a4d8a417 Back out r818492 which prevented all caching of incomplete responses.
Instead move the check to mod_disk_cache.  This leaves cache implementations
the flexibility to implement caching of incomplete responses.
PR: 15866


git-svn-id: https://svn.apache.org/repos/asf/httpd/httpd/trunk@821763 13f79535-47bb-0310-9956-ffa450edef68
2009-10-05 12:13:20 +00:00
f150bc9b04 Ensure that we call ap_meets_conditions() in the mod_cache normal handler
case, so that conditional requests are handled properly.


git-svn-id: https://svn.apache.org/repos/asf/httpd/httpd/trunk@821552 13f79535-47bb-0310-9956-ffa450edef68
2009-10-04 16:03:03 +00:00
f7ecd38d51 Remove an unused variable.
git-svn-id: https://svn.apache.org/repos/asf/httpd/httpd/trunk@821301 13f79535-47bb-0310-9956-ffa450edef68
2009-10-03 12:20:56 +00:00
3ae6189d47 mod_cache: Introduce the option to run the cache from within the
normal request handler, and to allow fine grained control over
where in the filter chain content is cached.


git-svn-id: https://svn.apache.org/repos/asf/httpd/httpd/trunk@821202 13f79535-47bb-0310-9956-ffa450edef68
2009-10-02 23:47:37 +00:00
83fea47fea * Use strcasecmp instead of strncasecmp as we want to be sure that the whole
word is None and not only the beginning.

Noted by Jeff Trawick


git-svn-id: https://svn.apache.org/repos/asf/httpd/httpd/trunk@819237 13f79535-47bb-0310-9956-ffa450edef68
2009-09-27 00:16:49 +00:00
546d17cd68 mod_cache: don't cache incomplete responses, per RFC 2616, 13.8.
PR: 15866


git-svn-id: https://svn.apache.org/repos/asf/httpd/httpd/trunk@818492 13f79535-47bb-0310-9956-ffa450edef68
2009-09-24 14:25:19 +00:00
1b68ef7771 Axe an unused variable.
git-svn-id: https://svn.apache.org/repos/asf/httpd/httpd/trunk@808724 13f79535-47bb-0310-9956-ffa450edef68
2009-08-28 01:32:18 +00:00
d3e08fa3ba Log the return code in the debug message to properly indicate why the lock
could not be obtained.


git-svn-id: https://svn.apache.org/repos/asf/httpd/httpd/trunk@808652 13f79535-47bb-0310-9956-ffa450edef68
2009-08-27 21:47:26 +00:00
9bf71872c9 Reintroduce an optimisation lost in some cut and paste. The cache lock
is removed as soon as we see an EOS, or is removed immediately if a
failure has occurred.


git-svn-id: https://svn.apache.org/repos/asf/httpd/httpd/trunk@808220 13f79535-47bb-0310-9956-ffa450edef68
2009-08-26 23:22:18 +00:00
2c379cc6fb mod_cache: Introduce the thundering herd lock, a mechanism to keep
the flood of requests at bay that strike a backend webserver as
a cached entity goes stale.


git-svn-id: https://svn.apache.org/repos/asf/httpd/httpd/trunk@808212 13f79535-47bb-0310-9956-ffa450edef68
2009-08-26 22:46:35 +00:00
cfc67db148 * Use the correct constant.
git-svn-id: https://svn.apache.org/repos/asf/httpd/httpd/trunk@778438 13f79535-47bb-0310-9956-ffa450edef68
2009-05-25 15:19:51 +00:00
d2700640cd * Add CacheIgnoreURLSessionIdentifiers directive to ignore
defined session identifiers encoded in the URL when caching.


git-svn-id: https://svn.apache.org/repos/asf/httpd/httpd/trunk@777042 13f79535-47bb-0310-9956-ffa450edef68
2009-05-21 10:42:54 +00:00
940a2bccca look for 'no-cache' in subprocess_env to prevent the saving
of an otherwise cacheable response.


git-svn-id: https://svn.apache.org/repos/asf/httpd/httpd/trunk@729316 13f79535-47bb-0310-9956-ffa450edef68
2008-12-24 15:03:33 +00:00
24f396ce76 When an expires or cache-control header are sent, the RFC does allow us to cache normally non-cacheable response statuses.
Submitted by: Alex Polvi <alex polvi.net>


git-svn-id: https://svn.apache.org/repos/asf/httpd/httpd/trunk@724093 13f79535-47bb-0310-9956-ffa450edef68
2008-12-07 06:33:02 +00:00
b3c481970a Centralize the error-header collapsing done when sending out cached replies. Mark the change in CHANGES as it may have unforseen fall out and/or may need to be reverted or done more subtle.
git-svn-id: https://svn.apache.org/repos/asf/httpd/httpd/trunk@649460 13f79535-47bb-0310-9956-ffa450edef68
2008-04-18 11:05:25 +00:00
e1ae2aa551 * Style police. No functional changes.
git-svn-id: https://svn.apache.org/repos/asf/httpd/httpd/trunk@649228 13f79535-47bb-0310-9956-ffa450edef68
2008-04-17 18:48:18 +00:00
aa35cf17c2 Centralize hop-by-hop header handling in the main mod_cache code. This change is a no-op -- i.e. we call the same code path as prior to the API renaming. However this is propably wrong; and we should have been cleansing the content-types all along
git-svn-id: https://svn.apache.org/repos/asf/httpd/httpd/trunk@649179 13f79535-47bb-0310-9956-ffa450edef68
2008-04-17 16:40:10 +00:00
a324a1d72f Remove all references to CORE_PRIVATE.
git-svn-id: https://svn.apache.org/repos/asf/httpd/httpd/trunk@645455 13f79535-47bb-0310-9956-ffa450edef68
2008-04-07 10:45:43 +00:00
e858f16bfb * Restore the original request headers if the cached resource was stale, as they
may be needed by further output filters like the byterange filter to make the
  correct decisions.

PR: 44579


git-svn-id: https://svn.apache.org/repos/asf/httpd/httpd/trunk@636386 13f79535-47bb-0310-9956-ffa450edef68
2008-03-12 16:07:46 +00:00
3019f9a87b mod_cache: Do not set Date or Expires when they are missing from the original
response or are invalid.


git-svn-id: https://svn.apache.org/repos/asf/httpd/httpd/trunk@539621 13f79535-47bb-0310-9956-ffa450edef68
2007-05-18 22:42:59 +00:00