You are viewing a plain text version of this content. The canonical link for it is here.
Posted to cvs@httpd.apache.org by rp...@apache.org on 2006/02/04 22:38:19 UTC

svn commit: r374931 - in /httpd/httpd/branches/2.2.x: CHANGES modules/cache/cache_storage.c

Author: rpluem
Date: Sat Feb  4 13:38:15 2006
New Revision: 374931

URL: http://svn.apache.org/viewcvs?rev=374931&view=rev
Log:
Merge r367798 from trunk:

* 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

Modified:
    httpd/httpd/branches/2.2.x/CHANGES
    httpd/httpd/branches/2.2.x/modules/cache/cache_storage.c

Modified: httpd/httpd/branches/2.2.x/CHANGES
URL: http://svn.apache.org/viewcvs/httpd/httpd/branches/2.2.x/CHANGES?rev=374931&r1=374930&r2=374931&view=diff
==============================================================================
--- httpd/httpd/branches/2.2.x/CHANGES [utf-8] (original)
+++ httpd/httpd/branches/2.2.x/CHANGES [utf-8] Sat Feb  4 13:38:15 2006
@@ -14,6 +14,9 @@
      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.

Modified: httpd/httpd/branches/2.2.x/modules/cache/cache_storage.c
URL: http://svn.apache.org/viewcvs/httpd/httpd/branches/2.2.x/modules/cache/cache_storage.c?rev=374931&r1=374930&r2=374931&view=diff
==============================================================================
--- httpd/httpd/branches/2.2.x/modules/cache/cache_storage.c (original)
+++ httpd/httpd/branches/2.2.x/modules/cache/cache_storage.c Sat Feb  4 13:38:15 2006
@@ -324,10 +324,25 @@
     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) {