Commit Graph

67 Commits

Author SHA1 Message Date
e62246ac2b SECURITY (CVE-2013-4352): Fix a NULL pointer deference which allowed
untrusted origin servers to crash mod_cache in a forward proxy configuration.

mod_cache: Avoid a crash with strcmp() when the hostname is not provided.


git-svn-id: https://svn.apache.org/repos/asf/httpd/httpd/trunk@1523235 13f79535-47bb-0310-9956-ffa450edef68
2013-09-14 13:32:25 +00:00
7e7f76f56c const goodness with nasty strrchr and strchr functions
(resolve warning in maintainer mode)


git-svn-id: https://svn.apache.org/repos/asf/httpd/httpd/trunk@1491564 13f79535-47bb-0310-9956-ffa450edef68
2013-06-10 18:43:45 +00:00
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
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
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
99a323a122 Silent no-prototype compiler warning.
git-svn-id: https://svn.apache.org/repos/asf/httpd/httpd/trunk@1478798 13f79535-47bb-0310-9956-ffa450edef68
2013-05-03 14:05:01 +00:00
0ef0994152 mod_cache: Make sure Vary processing handles multivalued Vary headers and
multivalued headers referred to via Vary.


git-svn-id: https://svn.apache.org/repos/asf/httpd/httpd/trunk@1478748 13f79535-47bb-0310-9956-ffa450edef68
2013-05-03 12:19:26 +00:00
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
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
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
523996f1f6 cache_storage: remove useless test + update function name in debug log + skip as soon as we know headers do not match
git-svn-id: https://svn.apache.org/repos/asf/httpd/httpd/trunk@1452281 13f79535-47bb-0310-9956-ffa450edef68
2013-03-04 13:02:09 +00:00
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
43fc2d47c7 mod_cache: When a request other than GET or HEAD arrives, we must
invalidate existing cache entities as per RFC2616 13.10. PR 15868.


git-svn-id: https://svn.apache.org/repos/asf/httpd/httpd/trunk@1070179 13f79535-47bb-0310-9956-ffa450edef68
2011-02-13 02:03:29 +00:00
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
c7194e2e36 Don't attempt to kill a stale entry that cannot be revalidated so early
in the process, as this will happen later anyway as necessary. We may want
to serve the stale entry should the backend not be available.


git-svn-id: https://svn.apache.org/repos/asf/httpd/httpd/trunk@1023398 13f79535-47bb-0310-9956-ffa450edef68
2010-10-17 01:24:24 +00:00
3b619648dc Don't attempt to remove the existing conditional headers until we have
committed to adding our own.


git-svn-id: https://svn.apache.org/repos/asf/httpd/httpd/trunk@1023396 13f79535-47bb-0310-9956-ffa450edef68
2010-10-17 00:50:28 +00:00
7ce9abf618 Support Cache-Control: only-if-cached, as per RFC2616 14.9.4.
git-svn-id: https://svn.apache.org/repos/asf/httpd/httpd/trunk@1023394 13f79535-47bb-0310-9956-ffa450edef68
2010-10-17 00:20:41 +00:00
fc7955190f Fix the error cases in the cache_select() loop. On error we must loop around
to the next provider, not return DECLINED too early, except for the
revalidate case, where returning DECLINED is correct behaviour.


git-svn-id: https://svn.apache.org/repos/asf/httpd/httpd/trunk@1023392 13f79535-47bb-0310-9956-ffa450edef68
2010-10-17 00:01:45 +00:00
44584f6a5a Fix the return values in the cache_select() function, we don't return APR
error codes in this case.


git-svn-id: https://svn.apache.org/repos/asf/httpd/httpd/trunk@1023390 13f79535-47bb-0310-9956-ffa450edef68
2010-10-16 23:42:25 +00:00
796d4cd074 Begin the process of optimising the parsing of Cache-Control headers. Parse
the incoming Cache-Control and Pragma headers once, instead of on each test.


git-svn-id: https://svn.apache.org/repos/asf/httpd/httpd/trunk@1023360 13f79535-47bb-0310-9956-ffa450edef68
2010-10-16 19:30:08 +00:00
38d82baaae mod_cache: Don't regenerate the cache key if we have already generated it.
git-svn-id: https://svn.apache.org/repos/asf/httpd/httpd/trunk@1004373 13f79535-47bb-0310-9956-ffa450edef68
2010-10-04 19:27:22 +00:00
d29eacb478 mod_cache: Allow control over the base URL of reverse proxied requests
using the CacheKeyBaseURL directive, so that the cache key can be
calculated from the endpoint URL instead of the server URL.


git-svn-id: https://svn.apache.org/repos/asf/httpd/httpd/trunk@1003963 13f79535-47bb-0310-9956-ffa450edef68
2010-10-03 13:23:39 +00:00
46a24e84f8 Remove a relic from the original error code, and fix segfaults in the
process.


git-svn-id: https://svn.apache.org/repos/asf/httpd/httpd/trunk@1000395 13f79535-47bb-0310-9956-ffa450edef68
2010-09-23 10:17:07 +00:00
fe32c3562b Make cache_provider_list and cache_request_rec private by moving them
out of mod_cache.h.


git-svn-id: https://svn.apache.org/repos/asf/httpd/httpd/trunk@1000247 13f79535-47bb-0310-9956-ffa450edef68
2010-09-22 21:35:38 +00:00
5c7154ed33 Make cache_server_conf, cache_enable and cache_disable private. Remove
public prefixes from ap_cache_accept_headers, ap_cache_try_lock and
ap_cache_get_providers.


git-svn-id: https://svn.apache.org/repos/asf/httpd/httpd/trunk@1000211 13f79535-47bb-0310-9956-ffa450edef68
2010-09-22 20:44:50 +00:00
8a91dc4dbe Make ap_cache_accept_headers, ap_cache_accept_headers, ap_cache_try_lock and
ap_cache_check_freshness private.


git-svn-id: https://svn.apache.org/repos/asf/httpd/httpd/trunk@1000187 13f79535-47bb-0310-9956-ffa450edef68
2010-09-22 20:28:11 +00:00
502a305b1d Remove the MOD_CACHE_REQUEST_REC hack, and pass the cache_request_rec
structure through mod_cache's function parameters in the usual way.


git-svn-id: https://svn.apache.org/repos/asf/httpd/httpd/trunk@1000152 13f79535-47bb-0310-9956-ffa450edef68
2010-09-22 19:35:26 +00:00
c8de96f357 Move private cache_* declarations out of the public mod_cache.h file.
git-svn-id: https://svn.apache.org/repos/asf/httpd/httpd/trunk@999681 13f79535-47bb-0310-9956-ffa450edef68
2010-09-21 22:55:22 +00:00
d8fc5d96a8 mod_cache: Give the cache provider the opportunity to choose to cache
or not cache based on the buckets present in the brigade, such as the
presence of a FILE bucket.


git-svn-id: https://svn.apache.org/repos/asf/httpd/httpd/trunk@999630 13f79535-47bb-0310-9956-ffa450edef68
2010-09-21 20:43:44 +00:00
c3084aa4de mod_cache: Check the request to determine whether we are allowed
to return cached content at all, and respect a "Cache-Control:
no-cache" header from a client. Previously, "no-cache" would
behave like "max-age=0".


git-svn-id: https://svn.apache.org/repos/asf/httpd/httpd/trunk@992625 13f79535-47bb-0310-9956-ffa450edef68
2010-09-04 15:20:30 +00:00
8991d4795f mod_cache: Use a proper filter context to hold filter data instead
of misusing the per-request configuration. Fixes a segfault on trunk
when the normal handler is used.


git-svn-id: https://svn.apache.org/repos/asf/httpd/httpd/trunk@992614 13f79535-47bb-0310-9956-ffa450edef68
2010-09-04 14:42:30 +00:00
ad53d4dcbd CVE-2010-1452: Fix handling of missing path segments in the parsed URI structure.
If a specially crafted request was sent, it is possible to crash mod_dav, 
mod_cache or mod_session, as they accessed a field that is set to NULL
by the URI parser, assuming that it always put in a valid string.

PR: 49246
Submitted by: Mark Drayton
Patch by: Jeff Trawick


git-svn-id: https://svn.apache.org/repos/asf/httpd/httpd/trunk@966348 13f79535-47bb-0310-9956-ffa450edef68
2010-07-21 18:25:01 +00:00
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
2173f71a93 Allow several of the configured session identifiers to be found and removed in
a single request.


git-svn-id: https://svn.apache.org/repos/asf/httpd/httpd/trunk@897705 13f79535-47bb-0310-9956-ffa450edef68
2010-01-10 21:07:26 +00:00
8a66869e0c * Do an exact match of the keys defined by CacheIgnoreURLSessionIdentifiers
against the querystring instead of a partial match.

PR: 48401
Submitted by: Dodou Wang <wangdong.08 gmail.com>
Reviewed by: rpluem


git-svn-id: https://svn.apache.org/repos/asf/httpd/httpd/trunk@892289 13f79535-47bb-0310-9956-ffa450edef68
2009-12-18 16:03:13 +00:00
2c379cc6fb mod_cache: Introduce the thundering herd lock, a mechanism to keep
the flood of requests at bay that strike a backend webserver as
a cached entity goes stale.


git-svn-id: https://svn.apache.org/repos/asf/httpd/httpd/trunk@808212 13f79535-47bb-0310-9956-ffa450edef68
2009-08-26 22:46:35 +00:00
023b0a4f61 * Correctly detect if CacheIgnoreURLSessionIdentifiers is set.
git-svn-id: https://svn.apache.org/repos/asf/httpd/httpd/trunk@778439 13f79535-47bb-0310-9956-ffa450edef68
2009-05-25 15:24:47 +00:00
d2700640cd * Add CacheIgnoreURLSessionIdentifiers directive to ignore
defined session identifiers encoded in the URL when caching.


git-svn-id: https://svn.apache.org/repos/asf/httpd/httpd/trunk@777042 13f79535-47bb-0310-9956-ffa450edef68
2009-05-21 10:42:54 +00:00
a324a1d72f Remove all references to CORE_PRIVATE.
git-svn-id: https://svn.apache.org/repos/asf/httpd/httpd/trunk@645455 13f79535-47bb-0310-9956-ffa450edef68
2008-04-07 10:45:43 +00:00
1fb72c6dd2 * Do not do Range requests if we use our own conditionals for validating
a cache entity: If we get 304 the Range does not matter and otherwise the
  entity changed and we want to have the complete entity.

PR: 44579


git-svn-id: https://svn.apache.org/repos/asf/httpd/httpd/trunk@636653 13f79535-47bb-0310-9956-ffa450edef68
2008-03-13 07:28:40 +00:00
477744b538 * Save the key we generate during our first run of cache_generate_key_default
on each request in the request_config. During consecutive runs of
  cache_generate_key_default during processing the request we restore it
  from there as we might not be able to generate the same key again as
  the ingredients used to compose the key might have changed and we constantly
  must use a key that could be generated during the quick handler phase.

PR: 41475


git-svn-id: https://svn.apache.org/repos/asf/httpd/httpd/trunk@506621 13f79535-47bb-0310-9956-ffa450edef68
2007-02-12 20:29:04 +00:00
8a7fb4574c * Add CacheIgnoreQueryString directive to cache requests with a query string
even if no expiration time is specified. Futhermore the query string will not
  be used for key generation such that requests to the same URI path, but with
  different query strings are mapped to the same cache entity. Turning this
  setting to ON violates RFC 2616/13.9 and thus it is turned off by default.

PR: 41484
Submitted by: Fredrik Widlund <fredrik.widlund qbrick.com>
Reviewed by: rpluem


git-svn-id: https://svn.apache.org/repos/asf/httpd/httpd/trunk@504183 13f79535-47bb-0310-9956-ffa450edef68
2007-02-06 15:55:50 +00:00
7410019c69 * Remove expired content from cache that cannot be revalidated.
PR: 30370


git-svn-id: https://svn.apache.org/repos/asf/httpd/httpd/trunk@481886 13f79535-47bb-0310-9956-ffa450edef68
2006-12-03 20:51:13 +00:00
e6a844c031 * Use the query string stored in r->parsed_uri.query instead of r->args
as r->args could have been changed (e.g. via mod_rewrite) after the quick
  handler hook. This causes resources to be stored under a key, where they
  cannot be fetched again in the quick handler.

PR: 40805


git-svn-id: https://svn.apache.org/repos/asf/httpd/httpd/trunk@476625 13f79535-47bb-0310-9956-ffa450edef68
2006-11-18 22:17:33 +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
6b175e597f * Keep the Content-Type for successfully revalidated
cached objects, by unsetting possible Content-Type headers in
  r->headers_out and r->err_headers_out as they may be different to what
  we have received from the cache.
  Actually they are not needed as r->content_type set by
  ap_set_content_type a few lines above will be used in the store_headers
  functions of the storage providers as a fallback and the HTTP_HEADER filter
  does overwrite the Content-Type header with r->content_type anyway.

PR: 39647


git-svn-id: https://svn.apache.org/repos/asf/httpd/httpd/trunk@410370 13f79535-47bb-0310-9956-ffa450edef68
2006-05-30 20:48:09 +00:00
db02633be5 * Cleanup the code by replacing some inline code to lower-case a string with
ap_str_tolower.

Proposed by: Joe Orton


git-svn-id: https://svn.apache.org/repos/asf/httpd/httpd/trunk@408729 13f79535-47bb-0310-9956-ffa450edef68
2006-05-22 19:05:09 +00:00
6ce4498198 * Fix const compiler warning introduced by r407357.
Noticed by: Joe Orton


git-svn-id: https://svn.apache.org/repos/asf/httpd/httpd/trunk@408154 13f79535-47bb-0310-9956-ffa450edef68
2006-05-21 10:29:09 +00:00
a3d86dbf15 * Handle the cases "no proxy request" and "reverse proxy request" in the same
manner, when setting scheme and port_str. This is needed because if a cached
  entry is looked up by mod_cache's quick handler r->proxyreq
  is still unset in the reverse proxy case as it only gets set in the
  translate name hook (either by ProxyPass or mod_rewrite) which is run
  after the quick handler hook. This is different to the forward proxy
  case where it gets set before the quick handler is run (in the
  post_read_request hook).
  If a cache entry is created by the CACHE_SAVE filter we always have
  r->proxyreq set correctly.
  Also set scheme to ap_http_scheme(r) instead of "http" to handle SSL
  correctly.

PR: 39593


git-svn-id: https://svn.apache.org/repos/asf/httpd/httpd/trunk@407357 13f79535-47bb-0310-9956-ffa450edef68
2006-05-17 19:16:43 +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