You are viewing a plain text version of this content. The canonical link for it is here.
Posted to cvs@httpd.apache.org by ji...@apache.org on 2007/07/05 20:22:02 UTC
svn commit: r553596 - in /httpd/httpd/branches/2.2.x: CHANGES STATUS
modules/cache/mod_cache.c
Author: jim
Date: Thu Jul 5 11:22:01 2007
New Revision: 553596
URL: http://svn.apache.org/viewvc?view=rev&rev=553596
Log:
Merge r539620 from trunk:
mod_cache: Correctly handle HEAD requests on expired cache content. PR 41230.
* modules/cache/mod_cache.c
(cache_save_filter): Properly handle HEAD responses when we have a stale handle.
(This patch was revised by Justin/Ruediger.)
Submitted by: Niklas Edmundsson
Reviewed by: Justin, Ruediger
Submitted by: jerenkrantz
Reviewed by: jim
Modified:
httpd/httpd/branches/2.2.x/CHANGES
httpd/httpd/branches/2.2.x/STATUS
httpd/httpd/branches/2.2.x/modules/cache/mod_cache.c
Modified: httpd/httpd/branches/2.2.x/CHANGES
URL: http://svn.apache.org/viewvc/httpd/httpd/branches/2.2.x/CHANGES?view=diff&rev=553596&r1=553595&r2=553596
==============================================================================
--- httpd/httpd/branches/2.2.x/CHANGES [utf-8] (original)
+++ httpd/httpd/branches/2.2.x/CHANGES [utf-8] Thu Jul 5 11:22:01 2007
@@ -1,6 +1,9 @@
-*- coding: utf-8 -*-
Changes with Apache 2.2.5
+ *) mod_cache: Correctly handle HEAD requests on expired cache content.
+ PR 41230. [Niklas Edmundsson]
+
*) SECURITY: CVE-2007-1863 (cve.mitre.org)
mod_cache: Prevent a segmentation fault if attributes are listed in a
Cache-Control header without any value.
Modified: httpd/httpd/branches/2.2.x/STATUS
URL: http://svn.apache.org/viewvc/httpd/httpd/branches/2.2.x/STATUS?view=diff&rev=553596&r1=553595&r2=553596
==============================================================================
--- httpd/httpd/branches/2.2.x/STATUS (original)
+++ httpd/httpd/branches/2.2.x/STATUS Thu Jul 5 11:22:01 2007
@@ -77,14 +77,6 @@
PATCHES ACCEPTED TO BACKPORT FROM TRUNK:
[ start all new proposals below, under PATCHES PROPOSED. ]
- * mod_cache: Correctly handle HEAD requests on expired cache content.
- PR 41230
- Trunk version of patch:
- http://svn.apache.org/viewvc?view=rev&revision=539620
- 2.2.x version of patch:
- (trunk applies cleanly)
- +1: jerenkrantz, rpluem, jim
-
* mod_cache: Do not set Date or Expires when missing/invalid.
Trunk version of patch:
http://svn.apache.org/viewvc?view=rev&revision=539621
Modified: httpd/httpd/branches/2.2.x/modules/cache/mod_cache.c
URL: http://svn.apache.org/viewvc/httpd/httpd/branches/2.2.x/modules/cache/mod_cache.c?view=diff&rev=553596&r1=553595&r2=553596
==============================================================================
--- httpd/httpd/branches/2.2.x/modules/cache/mod_cache.c (original)
+++ httpd/httpd/branches/2.2.x/modules/cache/mod_cache.c Thu Jul 5 11:22:01 2007
@@ -476,8 +476,8 @@
*/
reason = "No Last-Modified, Etag, or Expires headers";
}
- else if (r->header_only) {
- /* HEAD requests */
+ else if (r->header_only && !cache->stale_handle) {
+ /* Forbid HEAD requests unless we have it cached already */
reason = "HTTP HEAD request";
}
else if (!conf->store_nostore &&
@@ -596,7 +596,12 @@
* the headers).
*/
- /* Did we have a stale cache entry that really is stale? */
+ /* Did we have a stale cache entry that really is stale?
+ *
+ * Note that for HEAD requests, we won't get the body, so for a stale
+ * HEAD request, we don't remove the entity - instead we let the
+ * CACHE_REMOVE_URL filter remove the stale item from the cache.
+ */
if (cache->stale_handle) {
if (r->status == HTTP_NOT_MODIFIED) {
/* Oh, hey. It isn't that stale! Yay! */
@@ -604,7 +609,7 @@
info = &cache->handle->cache_obj->info;
rv = OK;
}
- else {
+ else if (!r->header_only) {
/* Oh, well. Toss it. */
cache->provider->remove_entity(cache->stale_handle);
/* Treat the request as if it wasn't conditional. */
@@ -612,8 +617,8 @@
}
}
- /* no cache handle, create a new entity */
- if (!cache->handle) {
+ /* no cache handle, create a new entity only for non-HEAD requests */
+ if (!cache->handle && !r->header_only) {
rv = cache_create_entity(r, size);
info = apr_pcalloc(r->pool, sizeof(cache_info));
/* We only set info->status upon the initial creation. */