Commit Graph

57 Commits

Author SHA1 Message Date
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
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
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
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
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
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
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
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
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
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
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
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
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
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
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
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
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
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
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
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
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
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
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
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
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
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
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
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
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
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
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
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
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
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
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
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
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
13424c5f6e - Remove unneeded cast.
Reported by: Garrett Rooney


git-svn-id: https://svn.apache.org/repos/asf/httpd/httpd/trunk@190547 13f79535-47bb-0310-9956-ffa450edef68
2005-06-14 01:50:27 +00:00
d4293052e2 - Partial revert of revision 190535. Remove const from tempfile, since apr_file_mktemp() requires it.
git-svn-id: https://svn.apache.org/repos/asf/httpd/httpd/trunk@190536 13f79535-47bb-0310-9956-ffa450edef68
2005-06-14 00:23:13 +00:00
e54924f2ac * cache/mod_disk_cache.c: Make most members of disk_cache_object into const char*. This removes the need to cast the const out in several places.
* cache/mod_cache.h: Make cache_object.key a const.



git-svn-id: https://svn.apache.org/repos/asf/httpd/httpd/trunk@190535 13f79535-47bb-0310-9956-ffa450edef68
2005-06-14 00:16:48 +00:00
605cba8fa8 - Remove unused dirlevels and dirlength from the cache info structure.
git-svn-id: https://svn.apache.org/repos/asf/httpd/httpd/trunk@190534 13f79535-47bb-0310-9956-ffa450edef68
2005-06-14 00:08:09 +00:00
e4ef99743c Based on feedback from dev@httpd, store Vary headers inside the '.header' file.
These Vary headers are used to build a new hash for a URL, based on the 
client's headers.  This allows mod_disk_cache to store many variations of one 
URI, where previously it would only store a single variant.

htcacheclean needs to be updated to understand the new file format.  I plan on 
updating htcacheclean in the next couple days.

PR: 35211


git-svn-id: https://svn.apache.org/repos/asf/httpd/httpd/trunk@190530 13f79535-47bb-0310-9956-ffa450edef68
2005-06-13 23:17:52 +00:00
4ae5658935 - link/unlink are not called directly, so we do not need this extra header.
git-svn-id: https://svn.apache.org/repos/asf/httpd/httpd/trunk@190047 13f79535-47bb-0310-9956-ffa450edef68
2005-06-11 00:33:48 +00:00
0d46d695a2 - Use apr_file_mktemp() and rename the header data file to its final location, instead of opening it and then writing it out as we go. Should prevent race conditions on busy servers.
git-svn-id: https://svn.apache.org/repos/asf/httpd/httpd/trunk@190043 13f79535-47bb-0310-9956-ffa450edef68
2005-06-11 00:26:19 +00:00
85015ced14 'generate_name' is too generic to be in the public symbols. Rename it to ap_cache_generate_name. No functional changes.
git-svn-id: https://svn.apache.org/repos/asf/httpd/httpd/trunk@179877 13f79535-47bb-0310-9956-ffa450edef68
2005-06-03 20:19:08 +00:00
438c65986e Tracked down by Justin Erenkrantz.
* modules/cache/mod_disk_cache.c

  (store_headers): Stop second guessing mod_cache and just store the
   headers in a new file (overwriting the old).

git-svn-id: https://svn.apache.org/repos/asf/httpd/httpd/trunk@156306 13f79535-47bb-0310-9956-ffa450edef68
2005-03-06 12:52:46 +00:00
519b48fce1 * modules/cache/mod_disk_cache.c (store_body): Fix format string
warnings; print integers using _FMT strings.

* modules/cache/cache_util.c (ap_cache_check_freshness): Remove unused
variable.

* modules/cache/cache_storage.c (cache_select_url): Remove unused
variable.


git-svn-id: https://svn.apache.org/repos/asf/httpd/httpd/trunk@153385 13f79535-47bb-0310-9956-ffa450edef68
2005-02-11 12:16:06 +00:00
441086ecfd More work to properly handle revalidated responses correctly.
* modules/cache/mod_cache.c: If we add a new Expires value, tell our client;
  merge in headers properly (or better than before) so that we can update the
  header fields on a revalidated but with updated header fields.
* modules/cache/mod_cache.h, modules/cache/cache_storage.c:
  Add preserve_orig flag to ap_cache_accept_headers to allow updating of fields.
* modules/cache/mod_disk_cache.c: Load status value from disk.


git-svn-id: https://svn.apache.org/repos/asf/httpd/httpd/trunk@152973 13f79535-47bb-0310-9956-ffa450edef68
2005-02-09 01:38:59 +00:00
f193418fa8 Make the function declaration match the prototype
git-svn-id: https://svn.apache.org/repos/asf/httpd/httpd/trunk@152927 13f79535-47bb-0310-9956-ffa450edef68
2005-02-08 19:41:15 +00:00
1d4c6d1c6d Cleanup structures in mod_cache and friends to remove unused or unnecessary
fields.  Also resolves a number of latent bugs due to the wrong fields being
accessed.


git-svn-id: https://svn.apache.org/repos/asf/httpd/httpd/trunk@152679 13f79535-47bb-0310-9956-ffa450edef68
2005-02-08 17:39:56 +00:00