1
0
mirror of https://github.com/apache/httpd.git synced 2026-01-06 09:01:14 +03:00
Commit Graph

166 Commits

Author SHA1 Message Date
Eric Covener
c9c90fca19 better s-maxage support
+  *) mod_cache: Consider Cache-Control: s-maxage in expiration
+     calculations.  [Eric Covener]
+
+  *) mod_cache: Allow caching of responses with an Expires header
+     in the past that also has Cache-Control: max-age or s-maxage.
+     PR55156. [Eric Covener]




git-svn-id: https://svn.apache.org/repos/asf/httpd/httpd/trunk@1726675 13f79535-47bb-0310-9956-ffa450edef68
2016-01-25 19:57:33 +00:00
Eric Covener
aa543e759a remove dead code leftover from r1023387.
Prior to this revision, there was an apr_atoi64 in this context.
Now, ap_cache_control() sets control.max_age (which is checked here) when
the maxage value was parsed OK.



git-svn-id: https://svn.apache.org/repos/asf/httpd/httpd/trunk@1718496 13f79535-47bb-0310-9956-ffa450edef68
2015-12-07 23:43:01 +00:00
Eric Covener
78d0543c4e duplicate debug-level AH00764 in the just-validated path.
git-svn-id: https://svn.apache.org/repos/asf/httpd/httpd/trunk@1718476 13f79535-47bb-0310-9956-ffa450edef68
2015-12-07 21:41:38 +00:00
Edward Lu
b2a5a379fc not sure how that got in there
git-svn-id: https://svn.apache.org/repos/asf/httpd/httpd/trunk@1704395 13f79535-47bb-0310-9956-ffa450edef68
2015-09-21 19:19:54 +00:00
Edward Lu
938a1c7470 Stop destroying headers when passing through the cache filter
git-svn-id: https://svn.apache.org/repos/asf/httpd/httpd/trunk@1704392 13f79535-47bb-0310-9956-ffa450edef68
2015-09-21 19:15:47 +00:00
Jan Kaluža
53e095830b * mod_cache: Preserve the Content-Type in case of 304 response.
304 does not contain Content-Type and mod_mime regenerates
the Content-Type based on the r->filename. This later leads to original
Content-Type to be lost (overwriten by whatever mod_mime generates).


git-svn-id: https://svn.apache.org/repos/asf/httpd/httpd/trunk@1665216 13f79535-47bb-0310-9956-ffa450edef68
2015-03-09 12:48:11 +00:00
Eric Covener
94c4cc461f fix another case of 304 response sent to an unconditional request
git-svn-id: https://svn.apache.org/repos/asf/httpd/httpd/trunk@1634237 13f79535-47bb-0310-9956-ffa450edef68
2014-10-25 17:45:30 +00:00
Yann Ylavic
edf45934d4 mod_cache: avoid unlikely access to freed memory.
git-svn-id: https://svn.apache.org/repos/asf/httpd/httpd/trunk@1632740 13f79535-47bb-0310-9956-ffa450edef68
2014-10-18 08:46:42 +00:00
Rainer Jung
7dd1f3d0c3 Fix typo in comment.
git-svn-id: https://svn.apache.org/repos/asf/httpd/httpd/trunk@1620461 13f79535-47bb-0310-9956-ffa450edef68
2014-08-25 21:32:43 +00:00
Eric Covener
31fffa60f9 don't let handlers start with r->status = 304 during a failed revalidation
PR56881



git-svn-id: https://svn.apache.org/repos/asf/httpd/httpd/trunk@1619835 13f79535-47bb-0310-9956-ffa450edef68
2014-08-22 15:26:27 +00:00
Yann Ylavic
baf4f92af0 mod_cache: follow up to r1591328.
Define the cache_merge_headers_out() function to merge r->err_headers_out into
r->headers_out and add the ones from r->content_type/encoding if available.
Use it in ap_cache_cacheable_headers_out() where the same is done and in
cache_save_filter() where this has to be done before updating the entry.


git-svn-id: https://svn.apache.org/repos/asf/httpd/httpd/trunk@1594643 13f79535-47bb-0310-9956-ffa450edef68
2014-05-14 17:11:49 +00:00
Yann Ylavic
308f0615fd mod_cache: follow up to r1591390
Fix code typo.


git-svn-id: https://svn.apache.org/repos/asf/httpd/httpd/trunk@1591394 13f79535-47bb-0310-9956-ffa450edef68
2014-04-30 16:53:00 +00:00
Yann Ylavic
f33d682667 mod_cache: follow up to r1591322
Avoid one unnecessary test when checking 304 contradictions.


git-svn-id: https://svn.apache.org/repos/asf/httpd/httpd/trunk@1591390 13f79535-47bb-0310-9956-ffa450edef68
2014-04-30 16:34:15 +00:00
Yann Ylavic
4d2d2c5edc mod_cache: Preserve non-cacheable headers forwarded from an origin 304
response. PR 55547.

When mod_cache asks for a revalidation of a stale entry and the origin responds
with a 304 (not that stale), the module strips the non-cacheable headers from
the origin response and merges the stale headers to update the cache.

The problem is that mod_cache won't forward the non-cacheable headers to the
client, for example if the 304 response contains both Set-Cookie and
'Cache-Control: no-cache="Set-Cookie"' headers, or CacheIgnoreHeaders is used.


git-svn-id: https://svn.apache.org/repos/asf/httpd/httpd/trunk@1591328 13f79535-47bb-0310-9956-ffa450edef68
2014-04-30 14:58:33 +00:00
Yann Ylavic
0e28401e45 mod_cache: follow up to r1591320.
Use the new MOD_CACHE_ENTITY_HEADERS[] names to check 304 contradictions
against the same headers.


git-svn-id: https://svn.apache.org/repos/asf/httpd/httpd/trunk@1591322 13f79535-47bb-0310-9956-ffa450edef68
2014-04-30 14:53:35 +00:00
Yann Ylavic
75e24df9a8 mod_cache: Don't add cached/revalidated entity headers to a 304 response.
PR 55547.

When the conditional request meets the conditions of the stale then revalidated
entry, the forwarded 304 response includes the entity headers merged from the
cached headers (before updating the entry).
Strip them before returning a 304.

Since the entity headers are stripped elsewhere, factorize the code using a
new table (MOD_CACHE_ENTITY_HEADERS[]) containing these headers's names.


git-svn-id: https://svn.apache.org/repos/asf/httpd/httpd/trunk@1591320 13f79535-47bb-0310-9956-ffa450edef68
2014-04-30 14:43:27 +00:00
Yann Ylavic
241c1c3d0e Revert r1591312 (again) to commit the 2 fixes separately.
git-svn-id: https://svn.apache.org/repos/asf/httpd/httpd/trunk@1591316 13f79535-47bb-0310-9956-ffa450edef68
2014-04-30 14:33:21 +00:00
Yann Ylavic
676b474db1 mod_cache: Don't add cached/revalidated entity headers to a 304 response.
PR 55547.

When the conditional request meets the conditions of the stale then revalidated
entry, the forwarded 304 response includes the entity headers merged from the
cached headers (before updating the entry).
Strip them before returning a 304.

Since the entity headers are stripped elsewhere, factorize the code using a
new table (MOD_CACHE_ENTITY_HEADERS[]) containing these headers's names.


git-svn-id: https://svn.apache.org/repos/asf/httpd/httpd/trunk@1591312 13f79535-47bb-0310-9956-ffa450edef68
2014-04-30 14:25:45 +00:00
Yann Ylavic
e14c0e4755 mod_cache: Retry unconditional request with the full URL (including the
query-string) when the origin server's 304 response does not
           match the conditions used to revalidate the stale entry.

http://www.mail-archive.com/dev@httpd.apache.org/msg59884.html


git-svn-id: https://svn.apache.org/repos/asf/httpd/httpd/trunk@1591143 13f79535-47bb-0310-9956-ffa450edef68
2014-04-29 23:28:11 +00:00
Christophe Jaillet
ebcf0f34d2 Fix layout
git-svn-id: https://svn.apache.org/repos/asf/httpd/httpd/trunk@1586827 13f79535-47bb-0310-9956-ffa450edef68
2014-04-12 07:57:44 +00:00
Eric Covener
43fbd8b76b leave a warning about cc_out
git-svn-id: https://svn.apache.org/repos/asf/httpd/httpd/trunk@1584429 13f79535-47bb-0310-9956-ffa450edef68
2014-04-03 22:19:23 +00:00
Eric Covener
b826c7cadd add the URI to DEBUG message 00765 (and drop an exclamation point):
Cache provider's store_body failed!



git-svn-id: https://svn.apache.org/repos/asf/httpd/httpd/trunk@1563193 13f79535-47bb-0310-9956-ffa450edef68
2014-01-31 17:40:54 +00:00
Eric Covener
397bdd8c43 Expires in a 304 is not a contradiction in terms of r1487118:
- Expires, Cache-Control, and/or Vary, if the field-value might
        differ from that sent in any previous response for the same
        variant




git-svn-id: https://svn.apache.org/repos/asf/httpd/httpd/trunk@1518269 13f79535-47bb-0310-9956-ffa450edef68
2013-08-28 16:07:50 +00:00
Eric Covener
39ebf1bf09 reflow a very long line, no functional change
git-svn-id: https://svn.apache.org/repos/asf/httpd/httpd/trunk@1502665 13f79535-47bb-0310-9956-ffa450edef68
2013-07-12 19:33:19 +00:00
Eric Covener
80475f6ca2 fix whitespace in AH00766 warning:
s/all of theinput/all of the input/



git-svn-id: https://svn.apache.org/repos/asf/httpd/httpd/trunk@1501423 13f79535-47bb-0310-9956-ffa450edef68
2013-07-09 18:21:43 +00:00
Stefan Fritsch
ca2948ea2d update log tags
replace duplicate, add missing


git-svn-id: https://svn.apache.org/repos/asf/httpd/httpd/trunk@1481396 13f79535-47bb-0310-9956-ffa450edef68
2013-05-11 19:45:09 +00:00
Graham Leggett
a6d1be91ef mod_cache: If a 304 response indicates an entity not currently cached, then
the cache MUST disregard the response and repeat the request without the 
conditional.


git-svn-id: https://svn.apache.org/repos/asf/httpd/httpd/trunk@1481197 13f79535-47bb-0310-9956-ffa450edef68
2013-05-10 21:40:54 +00:00
Graham Leggett
5c93801e65 Ensure that Warning headers are correctly handled as per RFC2616.
git-svn-id: https://svn.apache.org/repos/asf/httpd/httpd/trunk@1480283 13f79535-47bb-0310-9956-ffa450edef68
2013-05-08 14:06:48 +00:00
Graham Leggett
e225273e6a mod_cache: Ensure that we don't attempt to replace a cached response
with an older response as per RFC2616 13.12.


git-svn-id: https://svn.apache.org/repos/asf/httpd/httpd/trunk@1479966 13f79535-47bb-0310-9956-ffa450edef68
2013-05-07 16:16:16 +00:00
Graham Leggett
6194962c46 core, mod_cache: Ensure RFC2616 compliance in ap_meets_conditions()
with weak validation combined with If-Range and Range headers. Break
out explicit conditional header checks to be useable elsewhere in the
server. Ensure weak validation RFC compliance in the byteranges filter.
Ensure RFC validation compliance when serving cached entities. PR 16142


git-svn-id: https://svn.apache.org/repos/asf/httpd/httpd/trunk@1479905 13f79535-47bb-0310-9956-ffa450edef68
2013-05-07 13:42:31 +00:00
Graham Leggett
e362111d24 mod_cache: Ensure that updated responses to HEAD requests don't get
mistakenly paired with a previously cached body. Ensure that any existing
body is removed when a HEAD request is cached.


git-svn-id: https://svn.apache.org/repos/asf/httpd/httpd/trunk@1479411 13f79535-47bb-0310-9956-ffa450edef68
2013-05-05 22:27:31 +00:00
Graham Leggett
0eb8aa4a48 mod_cache: Honour Cache-Control: no-store in a request.
git-svn-id: https://svn.apache.org/repos/asf/httpd/httpd/trunk@1479222 13f79535-47bb-0310-9956-ffa450edef68
2013-05-05 01:12:48 +00:00
Graham Leggett
4d2b3c1a7d mod_cache: RFC2616 14.9.3 The s-maxage directive also implies the
semantics of the proxy-revalidate directive.


git-svn-id: https://svn.apache.org/repos/asf/httpd/httpd/trunk@1479216 13f79535-47bb-0310-9956-ffa450edef68
2013-05-04 23:03:13 +00:00
Graham Leggett
d1612031a9 mod_cache: Make sure that contradictory entity headers present in a 304
Not Modified response are caught and cause the entity to be removed.


git-svn-id: https://svn.apache.org/repos/asf/httpd/httpd/trunk@1479117 13f79535-47bb-0310-9956-ffa450edef68
2013-05-04 14:55:03 +00:00
Graham Leggett
f18afbfba1 mod_cache: When serving from cache, only the last header of a multivalued
header was taken into account. Fixed.


git-svn-id: https://svn.apache.org/repos/asf/httpd/httpd/trunk@1478441 13f79535-47bb-0310-9956-ffa450edef68
2013-05-02 16:51:27 +00:00
Graham Leggett
9f68cf2010 mod_cache: Ignore response headers specified by no-cache=header and
private=header as specified by RFC2616 14.9.1 What is Cacheable. Ensure
that these headers are still processed when multiple Cache-Control 
headers are present in the response. PR 54706


git-svn-id: https://svn.apache.org/repos/asf/httpd/httpd/trunk@1478382 13f79535-47bb-0310-9956-ffa450edef68
2013-05-02 14:24:26 +00:00
Graham Leggett
d32086bb4c Apply log message tags to messages.
git-svn-id: https://svn.apache.org/repos/asf/httpd/httpd/trunk@1478173 13f79535-47bb-0310-9956-ffa450edef68
2013-05-01 20:06:57 +00:00
Graham Leggett
6e77e5b20f mod_cache: Invalidate cached entities in response to RFC2616 Section
13.10 Invalidation After Updates or Deletions. PR 15868

Resolves outstanding issue with r1070179 as per
http://www.gossamer-threads.com/lists/apache/dev/395830?do=post_view_threaded#395830


git-svn-id: https://svn.apache.org/repos/asf/httpd/httpd/trunk@1478140 13f79535-47bb-0310-9956-ffa450edef68
2013-05-01 18:49:04 +00:00
Christophe Jaillet
aa6112daa6 Make option "CacheDisable" in mod_cache case insensitive.
PR 54462 reported by Tianyin Xu [tixu cs ucsd edu]

git-svn-id: https://svn.apache.org/repos/asf/httpd/httpd/trunk@1464721 13f79535-47bb-0310-9956-ffa450edef68
2013-04-04 20:13:19 +00:00
Rainer Jung
dba4500a80 Cache does no longer send Content-Type header
for fresh content.

Followup to r1361153+r1373447 (PR 53539, wrong
Content-Type for stale content).


git-svn-id: https://svn.apache.org/repos/asf/httpd/httpd/trunk@1439083 13f79535-47bb-0310-9956-ffa450edef68
2013-01-27 13:49:17 +00:00
Jeff Trawick
85ec79e3ce The following now respects DefaultRuntimeDir/DEFAULT_REL_RUNTIMEDIR:
- mod_cache: thundering herd lock directory


git-svn-id: https://svn.apache.org/repos/asf/httpd/httpd/trunk@1407381 13f79535-47bb-0310-9956-ffa450edef68
2012-11-09 08:44:08 +00:00
Rainer Jung
d247f6bafb Wrong content type and character set when
mod_cache serves stale content because of
a proxy error.

PR 53539.

Correction to r1361153.


git-svn-id: https://svn.apache.org/repos/asf/httpd/httpd/trunk@1373447 13f79535-47bb-0310-9956-ffa450edef68
2012-08-15 15:06:24 +00:00
Ruediger Pluem
423370980e * Set content type in case we return stale content.
git-svn-id: https://svn.apache.org/repos/asf/httpd/httpd/trunk@1361153 13f79535-47bb-0310-9956-ffa450edef68
2012-07-13 11:04:09 +00:00
Stefan Fritsch
d79b3c1513 Fix various filter functions to return apr_status_t instead of int
git-svn-id: https://svn.apache.org/repos/asf/httpd/httpd/trunk@1240315 13f79535-47bb-0310-9956-ffa450edef68
2012-02-03 19:48:01 +00:00
Graham Leggett
26559c25c5 mod_cache: Remove ap_cache_liststr(), it duplicates ap_find_token().
git-svn-id: https://svn.apache.org/repos/asf/httpd/httpd/trunk@1209798 13f79535-47bb-0310-9956-ffa450edef68
2011-12-03 00:31:53 +00:00
Stefan Fritsch
92e366007c Add lots of unique tags to error log messages
git-svn-id: https://svn.apache.org/repos/asf/httpd/httpd/trunk@1209766 13f79535-47bb-0310-9956-ffa450edef68
2011-12-02 23:02:04 +00:00
Jim Jagielski
f66d79b8b2 Use varargs...
git-svn-id: https://svn.apache.org/repos/asf/httpd/httpd/trunk@1205894 13f79535-47bb-0310-9956-ffa450edef68
2011-11-24 15:53:16 +00:00
Jim Jagielski
bf2fc8ee54 Use ap_pass_brigade_fchk()
git-svn-id: https://svn.apache.org/repos/asf/httpd/httpd/trunk@1205423 13f79535-47bb-0310-9956-ffa450edef68
2011-11-23 15:01:42 +00:00
Jim Jagielski
0871cc77f8 value never used: dead assignment
git-svn-id: https://svn.apache.org/repos/asf/httpd/httpd/trunk@1204555 13f79535-47bb-0310-9956-ffa450edef68
2011-11-21 15:51:44 +00:00
Graham Leggett
d4780b88c9 mod_cache: Make sure we merge headers correctly when we handle a non
cacheable conditional response. PR52120.


git-svn-id: https://svn.apache.org/repos/asf/httpd/httpd/trunk@1201331 13f79535-47bb-0310-9956-ffa450edef68
2011-11-12 21:24:47 +00:00