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

70 Commits

Author SHA1 Message Date
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
Colm MacCarthaigh
dd95d7c37c Update the copyright year in all .c, .h and .xml files
git-svn-id: https://svn.apache.org/repos/asf/httpd/httpd/trunk@395228 13f79535-47bb-0310-9956-ffa450edef68
2006-04-19 12:11:27 +00:00
Ruediger Pluem
8280850d65 * As per discussion on the list: Return error code of apr_file_write_full
or apr_bucket_read instead of APR_EGENERAL if they fail.


git-svn-id: https://svn.apache.org/repos/asf/httpd/httpd/trunk@390499 13f79535-47bb-0310-9956-ffa450edef68
2006-03-31 21:09:58 +00:00
Ruediger Pluem
a11b86ee63 * Check return value of apr_bucket_read when storing the response body to disk.
Delete already cached data if an error occurs.

Submitted by: Brian Akins <brian.akins turner.com>
Reviewed by: Ruediger Pluem


git-svn-id: https://svn.apache.org/repos/asf/httpd/httpd/trunk@389697 13f79535-47bb-0310-9956-ffa450edef68
2006-03-29 06:53:51 +00:00
Ruediger Pluem
dcc563844c * If the mod_proxy backend connection broke in the middle of the response,
then
  - Do not cache it.
  - Signal the client that something went wrong by closing the connection
    and not sending the last-chunk marker if the response was T-E chunked.

server/core_filters.c         : Close the connection to the client by setting
                                c->keepalive to AP_CONN_CLOSE.
modules/http/chunk_filter.c   : Do not send last-chunk marker in the case
                                the backend broke.
modules/proxy/mod_proxy_http.c: Signal that the backend connection broke.
modules/cache/mod_disk_cache.c: Respect r->no_cache for discarding the response


Submitted by: Roy T. Fielding, Jim Jagielski, Ruediger Pluem
Reviewed by: Roy T. Fielding, Jim Jagielski, Ruediger Pluem


git-svn-id: https://svn.apache.org/repos/asf/httpd/httpd/trunk@357461 13f79535-47bb-0310-9956-ffa450edef68
2005-12-18 12:07:39 +00:00
Jim Jagielski
08c97ba290 No functional change: remove "internal" tab spacing/formatting.
git-svn-id: https://svn.apache.org/repos/asf/httpd/httpd/trunk@345053 13f79535-47bb-0310-9956-ffa450edef68
2005-11-16 16:31:25 +00:00
Jim Jagielski
5061d9fa92 No functional Change: Removing trailing whitespace. This also
means that "blank" lines consisting of just spaces or
tabs are now really blank lines


git-svn-id: https://svn.apache.org/repos/asf/httpd/httpd/trunk@332306 13f79535-47bb-0310-9956-ffa450edef68
2005-11-10 15:11:44 +00:00
Colm MacCarthaigh
c6700d7708 remove some unused variables and re-name cache_select_url() to simply
cache_select()



git-svn-id: https://svn.apache.org/repos/asf/httpd/httpd/trunk@239420 13f79535-47bb-0310-9956-ffa450edef68
2005-08-23 15:25:08 +00:00
Andreas Steinmetz
59a68232cc Split mod_disk_cache.c into mod_disk_cache.c and mod_disk_cache.h
to allow inclusion of mod_disk_cache.h in htcacheclean.c.


git-svn-id: https://svn.apache.org/repos/asf/httpd/httpd/trunk@239406 13f79535-47bb-0310-9956-ffa450edef68
2005-08-23 13:35:00 +00:00
Justin Erenkrantz
8998c32fb6 mod_disk_cache: Remove the directory path of the cached file as far as possible
(up to the cache root) to get rid of unused empty directories.

* cache/mod_disk_cache.c
  (remove_url): Try to delete directories; also change two APR_ENOENT to
  APR_STATUS_IS_ENOENT.

(Justin tweaked some comments.)

Submitted by: Rudiger Plum <ruediger.pluem vodafone.com>
Reviewed by: Justin Erenkrantz


git-svn-id: https://svn.apache.org/repos/asf/httpd/httpd/trunk@232334 13f79535-47bb-0310-9956-ffa450edef68
2005-08-12 16:52:28 +00:00
Justin Erenkrantz
a992d08b42 Implement mod_disk_cache's remove_url.
(Minor tweaks and comment fixes by Justin.)

Suggested by: Paul Querna, Justin Erenkrantz
Submitted by: Rudiger Plum <ruediger.pluem vodafone.com>
Reviewed by: Justin Erenkrantz


git-svn-id: https://svn.apache.org/repos/asf/httpd/httpd/trunk@231486 13f79535-47bb-0310-9956-ffa450edef68
2005-08-11 17:31:10 +00:00
Justin Erenkrantz
d971ca4ef8 mod_disk_cache: Retry file rename up to three times to ameliorate race
condition with htcacheclean removing the directories underneath us.

(Includes tweaks by Justin.)

Suggested by: Graham Leggett
Submitted by: Andreas Steinmetz <ast@domdv.de>
Reviewed by: Justin Erenkrantz


git-svn-id: https://svn.apache.org/repos/asf/httpd/httpd/trunk@231349 13f79535-47bb-0310-9956-ffa450edef68
2005-08-10 23:03:38 +00:00
Paul Querna
01d65f9f59 Quick hack to store varied contents under the same path, making it
easier for admins to manage the cache.

Still requires modifications to htcacheclean to work.


git-svn-id: https://svn.apache.org/repos/asf/httpd/httpd/trunk@219945 13f79535-47bb-0310-9956-ffa450edef68
2005-07-20 16:56:23 +00:00
William A. Rowe Jr
2e3f62d979 caddr_t is quite non-portable, but a (void*) will do the trick.
git-svn-id: https://svn.apache.org/repos/asf/httpd/httpd/trunk@191174 13f79535-47bb-0310-9956-ffa450edef68
2005-06-17 16:27:58 +00:00
Bradley Nicholes
a5930f73ee Fix up some type mismatches that are causing compiler errors in Metrowerks on NetWare
git-svn-id: https://svn.apache.org/repos/asf/httpd/httpd/trunk@190819 13f79535-47bb-0310-9956-ffa450edef68
2005-06-15 21:37:10 +00:00