]> git.ipfire.org Git - thirdparty/apache/httpd.git/commitdiff
Merge r367798 from trunk:
authorRuediger Pluem <rpluem@apache.org>
Sat, 4 Feb 2006 21:38:15 +0000 (21:38 +0000)
committerRuediger Pluem <rpluem@apache.org>
Sat, 4 Feb 2006 21:38:15 +0000 (21:38 +0000)
* Fix PR38017 by handling the selection of the hostname in the same way for
  non proxied and reverse proxied requests.

  We need to handle both cases in the same manner as for the reverse proxy
  case we have the following situation:

  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.
  So we must ensure that in the reverse proxy case we use the same code
  path and using the canonical name seems to be the right thing to do
  in the reverse proxy case.

PR: 38017
Submitted by: rpluem
Reviewed by: rpluem, wrowe, colm

git-svn-id: https://svn.apache.org/repos/asf/httpd/httpd/branches/2.2.x@374931 13f79535-47bb-0310-9956-ffa450edef68

CHANGES
modules/cache/cache_storage.c

diff --git a/CHANGES b/CHANGES
index ed5f59750dd0a5bc233cea1d7b2497d3bf855150..f6ad1addff4436f76bc5615fe26c55b942fca7e6 100644 (file)
--- a/CHANGES
+++ b/CHANGES
@@ -14,6 +14,9 @@ Changes with Apache 2.2.1
      made to ap_escape_html so we escape quotes.  Reported by JPCERT.
      [Mark Cox]
 
+  *) mod_cache: Make caching of reverse proxies possible again. PR 38017.
+     [Ruediger Pluem]
+
   *) Modify apr[util] .h detection to avoid breakage on VPATH builds
      using Solaris make (amoung others) and avoid breakage in ./buildconf
      when srclib/apr[-util] are symlinks rather than directories proper.
index 3dc757027c33f1ac4e394b339795860d3e9337b3..ad8e10b648a4a2d7580975cec7847c95281bdec7 100644 (file)
@@ -324,10 +324,25 @@ apr_status_t cache_generate_key_default(request_rec *r, apr_pool_t* p,
     const char * hostname;
     int i;
 
-    /* Use the canonical name to improve cache hit rate, but only if this is
-     * not a proxy request.
+    /*
+     * Use the canonical name to improve cache hit rate, but only if this is
+     * not a proxy request or if this is a reverse proxy request.
+     * We need to handle both cases in the same manner as for the reverse proxy
+     * case we have the following situation:
+     *
+     * 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.
+     * So we must ensure that in the reverse proxy case we use the same code
+     * path and using the canonical name seems to be the right thing to do
+     * in the reverse proxy case.
      */
-    if (!r->proxyreq) {
+    if (!r->proxyreq || (r->proxyreq == PROXYREQ_REVERSE)) {
         /* Use _default_ as the hostname if none present, as in mod_vhost */
         hostname =  ap_get_server_name(r);
         if (!hostname) {