mod_disk_cache.c

Checkout Tools
  • last updated 4 hours ago
Constraints
Constraints: committers
 
Constraints: files
Constraints: dates
At long last, promote mod_cache and friends out of experimental/.

Also, take quick pass through docs files to remove experimental label for them.

Reviewed by: Paul Querna, Bill Stoddard, Justin Erenkrantz

  1. … 44 more files in changeset.
general property cleanup

  1. … 712 more files in changeset.
mod_disk_cache: Remove a bunch of non-implemented garbage collection

and cache size directives that are now available through htcacheclean.

  1. … 2 more files in changeset.
* modules/experimental/mod_disk_cache.c (recall_headers,

create_entity): Remove unused variables.

mod_cache: Add CacheIgnoreHeaders directive.

(Justin made some minor tweaks to the patch.)

PR: 30399

Submitted by: R�diger Pl�m <r.pluem@t-online.de>

Reviewed by: Justin Erenkrantz

  1. … 6 more files in changeset.
mod_disk_cache: don't store hop-by-hop headers on-disk.

  1. … 1 more file in changeset.
Try to correctly follow RFC 2616 13.3 on validating stale cache responses by

teaching mod_cache's cache_select_url and cache_save_filter how to deal with

this corner case.

* modules/experimental/cache_storage.c

(cache_select_url): If we have a stale entry, save the handle so that

cache_save_filter can use it later, and make the request conditional.

* modules/experimental/cache_util.c

(ap_cache_request_is_conditional): Take in a table rather than request_rec.

* modules/experimental/mod_cache.c

(cache_out_filter): Fix bogus comment.

(cache_save_filter): If we have already responded to the client, block all

data; correctly merge in 'stale' handles that are not really stale; set

r->status where appropriate; serve cached response if 'fresh'

* modules/experimental/mod_cache.h

(cache_info): Add a status field.

(cache_request_rec): Add stale handle field and note we may block responses.

(ap_cache_request_is_conditional): Update prototype.

* modules/experimental/mod_disk_cache.c

(store_headers): Use cache_info status instead of r->status.

* modules/experimental/mod_mem_cache.c

(recall_headers): Properly recall the status field.

(store_headers): Store the status field via cache_info status.

  1. … 6 more files in changeset.
mod_disk_cache: Do not store aborted content.

PR: 21492

Submitted by: R�diger Pl�m <r.pluem t-online.de>

Reviewed by: Justin Erenkrantz

  1. … 1 more file in changeset.
mod_disk_cache: Correctly store cached content type.

PR: 30278

Submitted by: R�diger Pl�m <r.pluem t-online.de>

Reviewed by: Justin Erenkrantz

  1. … 1 more file in changeset.
Fix race conditions in mod_disk_cache by properly using the tempfile rather

than the data file. (We rename the tempfile when we're completed with the data

file which is an atomic operation.)

Part of the code assumed that it was using a temporary file; other parts

wrote directly to the body file - which was incorrect. So, clean up the

whole mess to be consistent and more correct.

  1. … 1 more file in changeset.
Fix Expires (freshness) handling in mod_cache.

Previously, if the cached copy was stale, the response would go into an

indeterminate state. Therefore, the freshness check must be done before we

'accept' the response and, if it fails (i.e. stale), we can't allow any side

effects.

This caused a number of changes to how mod_disk_cache reads its headers as

ap_scan_script_header_err() purposely has side-effects and that's

unacceptable. So, factor out only what we need.

Also, remove the broken conditional filter code as you can't reliably alter the

filter list once the response is started. (Regardless, cache_select_url()

has the freshness checks now.)

Assist to Sascha Schumann for reporting mod_cache was busted.

  1. … 6 more files in changeset.

Eliminate several unused variables, observe a file size -> cache entry size

overflow, and reorder a few headers so we compile clean.

  1. … 2 more files in changeset.
mod_disk_cache: Implement binary format for on-disk header files.

Justin greatly extended Brian's patch and redid the rest of the storage format.

Submitted by: Brian Akins <bakins web.turner.com>

Reviewed by: Justin Erenkrantz

  1. … 1 more file in changeset.
Remove cache hooks and custom vtable format in favor of the ap_provider_* API.

Cache-related configuration directives remain the same.

  1. … 5 more files in changeset.
* modules/experimental/mod_disk_cache.c: Don't call MD5 twice for the same

value.

mod_disk_cache: Produce slightly more informative log messages and at more

appropriate levels. (LogLevel info will now only inform you when you are

storing a cache item. debug is required to show what is being served from

cache.)

Avoid confusion when reading mod_cache code. write_ and read_ often imply

network code; store_ and recall_ are more understandable prefixes in this

context.

Reviewed by: Roy Fielding, Cliff Woolley

  1. … 4 more files in changeset.
* modules/experimental/mod_disk_cache.c (open_entity): Allow the data file to

be sent via sendfile() and allow the header file to be buffered.

Reviewed by: Bill Stoddard

* modules/experimental/mod_disk_cache.c (load_headers): Only validate that the

header file descriptor is available. (fd is an unnecessary check here.)

Reviewed by: Bill Stoddard

Caching content from sources where Content-Length is not specified

(these were passed through uncached until now):

This needed additional checks for CacheMinFileSize and CacheMaxFileSize

after the response has completed. That means that we are checking at two

places now:

-> when the C-L is known, we check before we cache

-> when it is unknown we check "on-the-way" for CacheMaxFileSize, and

after caching completion for CacheMinFileSize

We now compare the actual size of the cached copy against the C-L

header, and discard it if the two don't match.

fix name of The Apache Software Foundation

  1. … 361 more files in changeset.
apply Apache License, Version 2.0

  1. … 262 more files in changeset.
update license to 2004.

  1. … 281 more files in changeset.
get rid of _FOREACH

  1. … 15 more files in changeset.

Modified the cache code to be header-location agnostic. Also

fixed a number of other cache code bugs related to PR 15852.

Includes a patch submitted by Sushma Rai <rsushma@novell.com>.

This fixes mod_mem_cache but not mod_disk_cache yet so I'm not

closing the PR since that is what they are using. [Paul J. Reder]

  1. … 6 more files in changeset.
finished that boring job:

update license to 2003.

Happy New Year! ;-))

  1. … 271 more files in changeset.
When storing the response headers in mod_cache, omit Transfer-Encoding

and any other hop-by-hop headers that shouldn't be applied when the

response is later delivered from cache:

http://marc.theaimsgroup.com/?l=apache-httpd-dev&m=103727389213072

Diagnosed by: Estrade Matthieu <estrade-m@ifrance.com>

  1. … 4 more files in changeset.

Improves the user friendliness of the CacheRoot processing

over my last pass. This version avoids the pool allocations

but doesn't avoid all of the runtime checks. It no longer

terminates during post-config processing. An error is logged

once per worker, indicating that the CacheRoot needs to be set.

[Paul J. Reder]

  1. … 2 more files in changeset.

Added code to process min and max file size directives and to

init the expirychk flag in mod_disk_cache. Added a clarifying

comment to cache_util. [Paul J. Reder]

  1. … 2 more files in changeset.

Change the CacheRoot processing to check for a required

value at config time. This saves a lot of wasted processing

if the mod_disk_cache module is loaded but no CacheRoot

was provided. This fix also adds code to log an error

and avoid useless pallocs and procesing when the computed

cache file name cannot be opened. This also updates the

docs accordingly. [Paul J. Reder]

  1. … 1 more file in changeset.