httpd-cvs mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From rpl...@apache.org
Subject svn commit: r425035 - in /httpd/httpd/branches/2.2.x: CHANGES STATUS modules/cache/cache_storage.c
Date Mon, 24 Jul 2006 13:05:20 GMT
Author: rpluem
Date: Mon Jul 24 06:05:19 2006
New Revision: 425035

URL: http://svn.apache.org/viewvc?rev=425035&view=rev
Log:
Merge r407357, r408154, r408729 from trunk:

* 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.

* Fix const compiler warning introduced by r407357.
Noticed by: Joe Orton

* Cleanup the code by replacing some inline code to lower-case a string with
  ap_str_tolower.
Proposed by: Joe Orton

PR: 39593
Submitted by: rpluem
Reviewed by: rpluem, jim, pquerna

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

Modified: httpd/httpd/branches/2.2.x/CHANGES
URL: http://svn.apache.org/viewvc/httpd/httpd/branches/2.2.x/CHANGES?rev=425035&r1=425034&r2=425035&view=diff
==============================================================================
--- httpd/httpd/branches/2.2.x/CHANGES [utf-8] (original)
+++ httpd/httpd/branches/2.2.x/CHANGES [utf-8] Mon Jul 24 06:05:19 2006
@@ -1,6 +1,9 @@
                                                         -*- coding: utf-8 -*-
 Changes with Apache 2.2.3
 
+  *) mod_cache: Make caching of reverse SSL proxies possible again. PR 39593.
+     [Ruediger Pluem, Joe Orton]
+
   *) Worker MPM: On graceless shutdown or restart, send signals to
      each worker thread to wake them up if they're polling on a
      Keep-Alive connection.  PR 38737.  [Chris Darroch]

Modified: httpd/httpd/branches/2.2.x/STATUS
URL: http://svn.apache.org/viewvc/httpd/httpd/branches/2.2.x/STATUS?rev=425035&r1=425034&r2=425035&view=diff
==============================================================================
--- httpd/httpd/branches/2.2.x/STATUS (original)
+++ httpd/httpd/branches/2.2.x/STATUS Mon Jul 24 06:05:19 2006
@@ -76,16 +76,6 @@
 PATCHES ACCEPTED TO BACKPORT FROM TRUNK:
   [ start all new proposals below, under PATCHES PROPOSED. ]
 
-    * mod_cache: Make caching of reverse SSL proxies possible again.
-      PR 39593.
-        Trunk version of patch:
-          http://svn.apache.org/viewvc?rev=407357&view=rev
-          http://svn.apache.org/viewvc?rev=408154&view=rev
-          http://svn.apache.org/viewvc?rev=408729&view=rev
-        2.2.x version of patch:
-          Trunk version works
-      +1: rpluem, jim, pquerna
-
     * Add optional 'scheme://' part to ServerName directive for cases
       where httpd runs behind an external SSL processor and has to
       learn from its configuration how to generate correct

Modified: httpd/httpd/branches/2.2.x/modules/cache/cache_storage.c
URL: http://svn.apache.org/viewvc/httpd/httpd/branches/2.2.x/modules/cache/cache_storage.c?rev=425035&r1=425034&r2=425035&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 Mon Jul 24 06:05:19 2006
@@ -320,8 +320,8 @@
 apr_status_t cache_generate_key_default(request_rec *r, apr_pool_t* p,
                                         char**key)
 {
-    char *port_str, *scheme, *hn;
-    const char * hostname;
+    char *port_str, *hn, *lcs;
+    const char *hostname, *scheme;
     int i;
 
     /*
@@ -351,10 +351,8 @@
     }
     else if(r->parsed_uri.hostname) {
         /* Copy the parsed uri hostname */
-        hn = apr_pcalloc(p, strlen(r->parsed_uri.hostname) + 1);
-        for (i = 0; r->parsed_uri.hostname[i]; i++) {
-            hn[i] = apr_tolower(r->parsed_uri.hostname[i]);
-        }
+        hn = apr_pstrdup(p, r->parsed_uri.hostname);
+        ap_str_tolower(hn);
         /* const work-around */
         hostname = hn;
     }
@@ -364,26 +362,34 @@
         hostname = "_default_";
     }
 
-    /* Copy the scheme, ensuring that it is lower case. If the parsed uri
-     * contains no string or if this is not a proxy request.
+    /*
+     * Copy the scheme, ensuring that it is lower case. If the parsed uri
+     * contains no string or if this is not a proxy request get the http
+     * scheme for this request. As r->parsed_uri.scheme is not set if this
+     * is a reverse proxy request, it is ensured that the cases
+     * "no proxy request" and "reverse proxy request" are handled in the same
+     * manner (see above why this is needed).
      */
     if (r->proxyreq && r->parsed_uri.scheme) {
-        /* Copy the scheme */
-        scheme = apr_pcalloc(p, strlen(r->parsed_uri.scheme) + 1);
-        for (i = 0; r->parsed_uri.scheme[i]; i++) {
-            scheme[i] = apr_tolower(r->parsed_uri.scheme[i]);
-        }
+        /* Copy the scheme and lower-case it */
+        lcs = apr_pstrdup(p, r->parsed_uri.scheme);
+        ap_str_tolower(lcs);
+        /* const work-around */
+        scheme = lcs;
     }
     else {
-        scheme = "http";
+        scheme = ap_http_scheme(r);
     }
 
-    /* If the content is locally generated, use the port-number of the
-     * current server. Otherwise. copy the URI's port-string (which may be a
-     * service name). If the URI contains no port-string, use apr-util's
-     * notion of the default port for that scheme - if available.
+    /*
+     * If this is a proxy request, but not a reverse proxy request (see comment
+     * above why these cases must be handled in the same manner), copy the
+     * URI's port-string (which may be a service name). If the URI contains
+     * no port-string, use apr-util's notion of the default port for that
+     * scheme - if available. Otherwise use the port-number of the current
+     * server.
      */
-    if(r->proxyreq) {
+    if(r->proxyreq && (r->proxyreq != PROXYREQ_REVERSE)) {
         if (r->parsed_uri.port_str) {
             port_str = apr_pcalloc(p, strlen(r->parsed_uri.port_str) + 2);
             port_str[0] = ':';



Mime
View raw message