1
0
mirror of https://github.com/apache/httpd.git synced 2025-11-06 16:49:32 +03:00
Commit Graph

84 Commits

Author SHA1 Message Date
Graham Leggett
5aff0e237b mod_disk_cache: Make sure we step down cleanly when we've ben configured
to cache but haven't set a CacheRoot.


git-svn-id: https://svn.apache.org/repos/asf/httpd/httpd/trunk@1026612 13f79535-47bb-0310-9956-ffa450edef68
2010-10-23 12:36:23 +00:00
Graham Leggett
f5d5cd33c5 Use ap_log_rerror() instead of ap_log_error() across mod_cache and
mod_disk_cache.


git-svn-id: https://svn.apache.org/repos/asf/httpd/httpd/trunk@1023462 13f79535-47bb-0310-9956-ffa450edef68
2010-10-17 11:34:03 +00:00
Graham Leggett
7229aa211b Complete the optimisation of Cache-Control header parsing. Make the
cache_control_t structure public so as to be available to mod_disk_cache.


git-svn-id: https://svn.apache.org/repos/asf/httpd/httpd/trunk@1023387 13f79535-47bb-0310-9956-ffa450edef68
2010-10-16 23:15:52 +00:00
Graham Leggett
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
Graham Leggett
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
William A. Rowe Jr
d4c3801625 Eliminate nonportable cruft
git-svn-id: https://svn.apache.org/repos/asf/httpd/httpd/trunk@1021527 13f79535-47bb-0310-9956-ffa450edef68
2010-10-11 21:54:26 +00:00
Graham Leggett
fe000fbe5d Remove (and no longer initialise) an unused variable.
git-svn-id: https://svn.apache.org/repos/asf/httpd/httpd/trunk@1004463 13f79535-47bb-0310-9956-ffa450edef68
2010-10-04 22:35:54 +00:00
Graham Leggett
f21e960d57 Make sure the has_body flag is written to the disk cache file, so that
we don't interpret subsequent bodies as empty.


git-svn-id: https://svn.apache.org/repos/asf/httpd/httpd/trunk@1003893 13f79535-47bb-0310-9956-ffa450edef68
2010-10-02 21:38:49 +00:00
Graham Leggett
1fea6c7441 mod_disk_cache: CacheMaxFileSize, CacheMinFileSize, CacheReadSize and
CacheReadTime can be set per directory/location.


git-svn-id: https://svn.apache.org/repos/asf/httpd/httpd/trunk@1003839 13f79535-47bb-0310-9956-ffa450edef68
2010-10-02 17:31:35 +00:00
Graham Leggett
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
Graham Leggett
2daba6a048 mod_disk_cache: Instead of creating an empty data file when the body is
empty, don't create a file at all, saving inodes.


git-svn-id: https://svn.apache.org/repos/asf/httpd/httpd/trunk@1002832 13f79535-47bb-0310-9956-ffa450edef68
2010-09-29 20:00:11 +00:00
Graham Leggett
1aeb087542 mod_disk_cache: Change on-disk header file format to support the
link of the device/inode of the data file to the matching header
file, and to support the option of not writing a data file when
the data file is empty. Refactor the mod_disk_cache code so that
headers are written as late as possible (on commit), allowing the
device and inode of the body to be written to the header. At this
point, writes to the cache are now atomic, without locks.


git-svn-id: https://svn.apache.org/repos/asf/httpd/httpd/trunk@1002643 13f79535-47bb-0310-9956-ffa450edef68
2010-09-29 14:17:52 +00:00
Graham Leggett
18a8c46a59 Move mod_cache-private includes and defines from the public mod_cache.h
interface into the private cache_util.h interface.


git-svn-id: https://svn.apache.org/repos/asf/httpd/httpd/trunk@1000249 13f79535-47bb-0310-9956-ffa450edef68
2010-09-22 21:55:27 +00:00
Graham Leggett
20235c3937 Update mod_disk_cache to comply with the new create_entity() interface.
git-svn-id: https://svn.apache.org/repos/asf/httpd/httpd/trunk@999678 13f79535-47bb-0310-9956-ffa450edef68
2010-09-21 22:47:14 +00:00
Graham Leggett
edb04a3c9f No need to call the cleanup in the forked-child case.
git-svn-id: https://svn.apache.org/repos/asf/httpd/httpd/trunk@997676 13f79535-47bb-0310-9956-ffa450edef68
2010-09-16 10:08:18 +00:00
Graham Leggett
d3f17c03b1 Ensure the return value is initialised.
git-svn-id: https://svn.apache.org/repos/asf/httpd/httpd/trunk@997664 13f79535-47bb-0310-9956-ffa450edef68
2010-09-16 09:56:38 +00:00
Graham Leggett
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
Graham Leggett
721d19a58b Handle the case where a brigade might have buckets following the eos
bucket. In this case the cache provider passes all buckets through as
is once the cached entry is marked as done.


git-svn-id: https://svn.apache.org/repos/asf/httpd/httpd/trunk@996713 13f79535-47bb-0310-9956-ffa450edef68
2010-09-13 22:35:51 +00:00
Graham Leggett
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
Stefan Fritsch
a0e0e585b0 Disable sendfile by default, as discussed at
http://mail-archives.apache.org/mod_mbox/httpd-dev/201007.mbox/<4C4355EE.2060605@rowe-clan.net>


git-svn-id: https://svn.apache.org/repos/asf/httpd/httpd/trunk@992689 13f79535-47bb-0310-9956-ffa450edef68
2010-09-04 21:53:06 +00:00
Stefan Fritsch
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
Graham Leggett
fd646c8e2b mod_disk_cache: Decline the opportunity to cache if the response is
a 206 Partial Content. This stops a reverse proxied partial response
from becoming cached, and then being served in subsequent responses.


git-svn-id: https://svn.apache.org/repos/asf/httpd/httpd/trunk@951222 13f79535-47bb-0310-9956-ffa450edef68
2010-06-04 00:17:16 +00:00
William A. Rowe Jr
2098898eb1 in preparation of fixing 2.2 branch, change again, now to a cast-less solution
git-svn-id: https://svn.apache.org/repos/asf/httpd/httpd/trunk@917611 13f79535-47bb-0310-9956-ffa450edef68
2010-03-01 17:54:15 +00:00
William A. Rowe Jr
f568428323 Revert nonsense I introduced in r885689; solve cl test correctly
git-svn-id: https://svn.apache.org/repos/asf/httpd/httpd/trunk@885694 13f79535-47bb-0310-9956-ffa450edef68
2009-12-01 08:59:41 +00:00
William A. Rowe Jr
3e338e488c Elaborate on low hanging XXX fruit
git-svn-id: https://svn.apache.org/repos/asf/httpd/httpd/trunk@885689 13f79535-47bb-0310-9956-ffa450edef68
2009-12-01 08:44:11 +00:00
Daniel Earl Poirier
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
Lars Eilebrecht
77188b407d fix mod_disk_cache to support EnableSendfile.
git-svn-id: https://svn.apache.org/repos/asf/httpd/httpd/trunk@746541 13f79535-47bb-0310-9956-ffa450edef68
2009-02-21 17:07:01 +00:00
Dirk-Willem van Gulik
a0561f4c05 Centralize hop-by-hop header handling in the disk caching code. Note that 'out' now has actual out semantics; hence the change in headers_in.
git-svn-id: https://svn.apache.org/repos/asf/httpd/httpd/trunk@649176 13f79535-47bb-0310-9956-ffa450edef68
2008-04-17 16:37:24 +00:00
Dirk-Willem van Gulik
dca366b400 Incorperate feedback of Rudiger.
git-svn-id: https://svn.apache.org/repos/asf/httpd/httpd/trunk@620610 13f79535-47bb-0310-9956-ffa450edef68
2008-02-11 21:06:58 +00:00
Dirk-Willem van Gulik
6f50e36657 Return a little bit more error information when, say a disk is full or something gets write protected. Note that in some cases mod_cache.c will_also_ log a 'cache: store_headers failed' subsequently.
git-svn-id: https://svn.apache.org/repos/asf/httpd/httpd/trunk@620489 13f79535-47bb-0310-9956-ffa450edef68
2008-02-11 14:27:34 +00:00
Ruediger Pluem
deec7859b2 * Change loglevel from ERROR to WARNING if the renaming of the vary, headers
or data file fails.


git-svn-id: https://svn.apache.org/repos/asf/httpd/httpd/trunk@607440 13f79535-47bb-0310-9956-ffa450edef68
2007-12-29 16:19:51 +00:00
Ruediger Pluem
c8dd361906 * Make loglevel consistent for similar situations. As this really should not
happen set it to error.


git-svn-id: https://svn.apache.org/repos/asf/httpd/httpd/trunk@607245 13f79535-47bb-0310-9956-ffa450edef68
2007-12-28 14:16:35 +00:00
Justin Erenkrantz
c795f75fea mod_disk_cache: If the Vary'd content is stale, we can handle it via our
freshness tests which will attempt to revalidate the content.

* modules/cache/mod_disk_cache.c
  (open_entity): If the root Vary index is stale, we don't need to throw away
  potentially stale content - we can try to refresh it.


git-svn-id: https://svn.apache.org/repos/asf/httpd/httpd/trunk@539054 13f79535-47bb-0310-9956-ffa450edef68
2007-05-17 18:17:23 +00:00
Justin Erenkrantz
9b5dff0669 mod_disk_cache: When renegotiating an already cached Vary'd response, do not
let us later throw away the renegotiated content due to a name mismatch.

We do not need to update the ->name field just before writing the headers as
the computed ->name on open and create is sufficient.  Updating ->name here is
essentially a no-op - except in the case of Vary where the key has internally
changed (to account for the Vary prefix), but the original name has not.
However, writing the Vary'd-accounted key means that when we read the cache
next that we will error out and disregard the just renegotiated response and
fetch the content all over again - oops!

(This is largely a case where I think we may have overthought ourselves; hence
the explanation is here in the commit rather than in the file itself.)

* modules/cache/mod_disk_cache.c
  (store_headers): The originally opened ->name is sufficient.
* CHANGES: Combined with r538992, note that renegotiation for Vary's seem to
  work far better.


git-svn-id: https://svn.apache.org/repos/asf/httpd/httpd/trunk@538997 13f79535-47bb-0310-9956-ffa450edef68
2007-05-17 16:20:06 +00:00
Justin Erenkrantz
c1150a199a mod_disk_cache: When renegotiating an already cached Vary'd response, create
the refreshed .vary structure in the right directory.  Otherwise, we'll create
a new .vary layout underneath the already existing one - oops!

* modules/cache/mod_disk_cache.c
  (store_headers): Temporarily clear dobj->prefix if it is set to ensure that
  we create the .vary structure underneath the cache root.


git-svn-id: https://svn.apache.org/repos/asf/httpd/httpd/trunk@538992 13f79535-47bb-0310-9956-ffa450edef68
2007-05-17 16:10:29 +00:00
Graham Leggett
a9f530e317 This time from the top, with three part harmony AND feeling...
Revert the read-while-caching and large-file-crash fixes for mod_disk_cache,
ready to start again.

Reverted: r450105 r450188 r462571 r462601 r462696 r467655 r467684 r468044
r468373 r468409 r470455



git-svn-id: https://svn.apache.org/repos/asf/httpd/httpd/trunk@502365 13f79535-47bb-0310-9956-ffa450edef68
2007-02-01 21:28:34 +00:00
Martin Kraemer
d3d381486d Fix broken compile for platforms with sendfile() -- As Graham says: Looks like this code hasn't built in the SENDFILE case for a while.
git-svn-id: https://svn.apache.org/repos/asf/httpd/httpd/trunk@470455 13f79535-47bb-0310-9956-ffa450edef68
2006-11-02 18:05:20 +00:00
Graham Leggett
b6534667de Restore the pdconf configuration structure in the SENDFILE case.
git-svn-id: https://svn.apache.org/repos/asf/httpd/httpd/trunk@468409 13f79535-47bb-0310-9956-ffa450edef68
2006-10-27 15:15:24 +00:00
Graham Leggett
66d027d551 mod_cache: Pass the output filter stack through the store_body()
hook, giving each cache backend the ability to make a better
decision as to how it will allocate the tasks of writing to the
cache and writing to the network. Previously the write to the
cache task needed to be complete before the same brigade was
written to the network, and this caused timing and memory issues
on large cached files. This fix replaces the previous fix for
PR39380.


git-svn-id: https://svn.apache.org/repos/asf/httpd/httpd/trunk@468373 13f79535-47bb-0310-9956-ffa450edef68
2006-10-27 13:28:56 +00:00
Graham Leggett
f53558c769 mod_disk_cache: Implement read-while-caching.
git-svn-id: https://svn.apache.org/repos/asf/httpd/httpd/trunk@462696 13f79535-47bb-0310-9956-ffa450edef68
2006-10-11 04:31:18 +00:00
Graham Leggett
2d326ca407 mod_disk_cache: NULL fd pointers when closing them, fix missing
close/flush, remove some unneccessary code duplication instead
of calling the right helper in replace_brigade_with_cache().


git-svn-id: https://svn.apache.org/repos/asf/httpd/httpd/trunk@462601 13f79535-47bb-0310-9956-ffa450edef68
2006-10-10 22:10:01 +00:00
Graham Leggett
a0207d2ff9 mod_disk_cache: Do away with the write-to-file-then-move-in-place
mentality.


git-svn-id: https://svn.apache.org/repos/asf/httpd/httpd/trunk@462571 13f79535-47bb-0310-9956-ffa450edef68
2006-10-10 21:17:47 +00:00
Graham Leggett
4ac2f4bff6 Allocate the temporary copy file buffer from a pool.
git-svn-id: https://svn.apache.org/repos/asf/httpd/httpd/trunk@450188 13f79535-47bb-0310-9956-ffa450edef68
2006-09-26 20:35:42 +00:00
Graham Leggett
4116db0d19 mod_disk_cache: Make caching of large files possible on 32bit machines
by determining whether the cached file should be copied on disk rather
than loaded into RAM. PR39380


git-svn-id: https://svn.apache.org/repos/asf/httpd/httpd/trunk@450105 13f79535-47bb-0310-9956-ffa450edef68
2006-09-26 16:26:56 +00:00
Graham Leggett
cbf599cfd7 mod_disk_cache: Make sure that only positive integers are accepted
for the CacheMaxFileSize and CacheMinFileSize parameters in the
config file. PR39380 [Niklas Edmundsson <nikke acc.umu.se>]


git-svn-id: https://svn.apache.org/repos/asf/httpd/httpd/trunk@450042 13f79535-47bb-0310-9956-ffa450edef68
2006-09-26 13:29:09 +00:00
Roy T. Fielding
de659cbed0 update license header text
git-svn-id: https://svn.apache.org/repos/asf/httpd/httpd/trunk@420983 13f79535-47bb-0310-9956-ffa450edef68
2006-07-11 20:33:53 +00:00
Joe Orton
c13f8dd6eb * server/core.c (default_handler): Use apr_brigade_insert_file() to
append the file to the brigade.

* server/protocol.c (ap_send_fd),
modules/proxy/mod_proxy_http.c (spool_reqbody_cl), 
modules/cache/mod_mem_cache.c (recall_body),
modules/cache/mod_disk_cache.c (recall_body),
modules/mappers/mod_negotiation.c (handle_map_file),
modules/generators/mod_asis.c (asis_handler),
modules/dav/fs/repos.c [DEBUG_GET_HANDLER] (dav_fs_deliver),
modules/arch/win32/mod_isapi.c (ServerSupportFunction): Likewise.


git-svn-id: https://svn.apache.org/repos/asf/httpd/httpd/trunk@414238 13f79535-47bb-0310-9956-ffa450edef68
2006-06-14 13:16:29 +00:00
Ruediger Pluem
cab5846455 * If possible, check if the size of an object to cache is within the
configured boundaries before actually saving data.

Submitted by: Niklas Edmundsson <nikke acc.umu.se>
Reviewed by: rpluem


git-svn-id: https://svn.apache.org/repos/asf/httpd/httpd/trunk@411469 13f79535-47bb-0310-9956-ffa450edef68
2006-06-03 20:52:58 +00:00
Ruediger Pluem
5450296c9a * Remove temporary files if renaming fails, otherwise they may accumulate.
Submitted by: Davi Arnaut <davi haxent.com.br>
Reviewed by: rpluem


git-svn-id: https://svn.apache.org/repos/asf/httpd/httpd/trunk@409942 13f79535-47bb-0310-9956-ffa450edef68
2006-05-28 10:32:01 +00:00
Ruediger Pluem
3f821517aa * Consequently use disk_cache: in error log strings
PR: 39380
Submitted by: Niklas Edmundsson <nikke acc.umu.se>
Reviewed by: rpluem


git-svn-id: https://svn.apache.org/repos/asf/httpd/httpd/trunk@396252 13f79535-47bb-0310-9956-ffa450edef68
2006-04-23 10:52:48 +00:00