httpd-cvs mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From n.@apache.org
Subject cvs commit: httpd-2.0/modules/mappers mod_rewrite.c
Date Sat, 10 Apr 2004 20:23:51 GMT
nd          2004/04/10 13:23:51

  Modified:    .        CHANGES
               modules/mappers mod_rewrite.c
  Log:
  fix cache confusion which happens if different virtualhosts define
  rewritemaps with the same name.
  This is done using name mangling. For the cache we prefix the map name
  with the hex value of the current server struct pointer. This way
  inherited maps still use the same cache.
  
  PR: 26462
  
  Revision  Changes    Path
  1.1453    +4 -0      httpd-2.0/CHANGES
  
  Index: CHANGES
  ===================================================================
  RCS file: /home/cvs/httpd-2.0/CHANGES,v
  retrieving revision 1.1452
  retrieving revision 1.1453
  diff -u -u -r1.1452 -r1.1453
  --- CHANGES	10 Apr 2004 17:48:52 -0000	1.1452
  +++ CHANGES	10 Apr 2004 20:23:51 -0000	1.1453
  @@ -2,6 +2,10 @@
   
     [Remove entries to the current 2.0 section below, when backported]
   
  +  *) mod_rewrite no longer confuses the RewriteMap caches if
  +     different maps defined in different virtual hosts use the
  +     same map name. PR 26462.  [André Malo]
  +
     *) mod_log_config now logs all Set-Cookie headers if the %{Set-Cookie}o
        format is used.  PR 27787.  [André Malo]
   
  
  
  
  1.256     +17 -6     httpd-2.0/modules/mappers/mod_rewrite.c
  
  Index: mod_rewrite.c
  ===================================================================
  RCS file: /home/cvs/httpd-2.0/modules/mappers/mod_rewrite.c,v
  retrieving revision 1.255
  retrieving revision 1.256
  diff -u -u -r1.255 -r1.256
  --- mod_rewrite.c	3 Apr 2004 20:29:37 -0000	1.255
  +++ mod_rewrite.c	10 Apr 2004 20:23:51 -0000	1.256
  @@ -220,6 +220,7 @@
       const char *datafile;          /* filename for map data files         */
       const char *dbmtype;           /* dbm type for dbm map data files     */
       const char *checkfile;         /* filename to check for map existence */
  +    const char *cachename;         /* for cached maps (txt/rnd/dbm)       */
       int   type;                    /* the type of the map                 */
       apr_file_t *fpin;              /* in  file pointer for program maps   */
       apr_file_t *fpout;             /* out file pointer for program maps   */
  @@ -1449,7 +1450,7 @@
               return NULL;
           }
   
  -        value = get_cache_value(name, st.mtime, key, r->pool);
  +        value = get_cache_value(s->cachename, st.mtime, key, r->pool);
           if (!value) {
               rewritelog((r, 6, NULL,
                           "cache lookup FAILED, forcing new map lookup"));
  @@ -1458,13 +1459,13 @@
               if (!value) {
                   rewritelog((r, 5, NULL, "map lookup FAILED: map=%s[txt] key=%s",
                               name, key));
  -                set_cache_value(name, st.mtime, key, "");
  +                set_cache_value(s->cachename, st.mtime, key, "");
                   return NULL;
               }
   
               rewritelog((r, 5, NULL,"map lookup OK: map=%s[txt] key=%s -> val=%s",
                           name, key, value));
  -            set_cache_value(name, st.mtime, key, value);
  +            set_cache_value(s->cachename, st.mtime, key, value);
           }
           else {
               rewritelog((r,5,NULL,"cache lookup OK: map=%s[txt] key=%s -> val=%s",
  @@ -1492,7 +1493,7 @@
               return NULL;
           }
   
  -        value = get_cache_value(name, st.mtime, key, r->pool);
  +        value = get_cache_value(s->cachename, st.mtime, key, r->pool);
           if (!value) {
               rewritelog((r, 6, NULL,
                           "cache lookup FAILED, forcing new map lookup"));
  @@ -1501,14 +1502,14 @@
               if (!value) {
                   rewritelog((r, 5, NULL, "map lookup FAILED: map=%s[dbm] key=%s",
                               name, key));
  -                set_cache_value(name, st.mtime, key, "");
  +                set_cache_value(s->cachename, st.mtime, key, "");
                   return NULL;
               }
   
               rewritelog((r, 5, NULL, "map lookup OK: map=%s[dbm] key=%s -> "
                           "val=%s", name, key, value));
   
  -            set_cache_value(name, st.mtime, key, value);
  +            set_cache_value(s->cachename, st.mtime, key, value);
               return value;
           }
   
  @@ -2759,6 +2760,8 @@
           newmap->type      = MAPTYPE_TXT;
           newmap->datafile  = fname;
           newmap->checkfile = fname;
  +        newmap->cachename = apr_psprintf(cmd->pool, "%pp:%s",
  +                                         (void *)cmd->server, a1);
       }
       else if (strncasecmp(a2, "rnd:", 4) == 0) {
           if ((fname = ap_server_root_relative(cmd->pool, a2+4)) == NULL) {
  @@ -2769,6 +2772,8 @@
           newmap->type      = MAPTYPE_RND;
           newmap->datafile  = fname;
           newmap->checkfile = fname;
  +        newmap->cachename = apr_psprintf(cmd->pool, "%pp:%s",
  +                                         (void *)cmd->server, a1);
       }
       else if (strncasecmp(a2, "dbm", 3) == 0) {
           const char *ignored_fname;
  @@ -2776,6 +2781,8 @@
   
           newmap->type = MAPTYPE_DBM;
           fname = NULL;
  +        newmap->cachename = apr_psprintf(cmd->pool, "%pp:%s",
  +                                         (void *)cmd->server, a1);
   
           if (a2[3] == ':') {
               newmap->dbmtype = "default";
  @@ -2823,11 +2830,13 @@
           newmap->type      = MAPTYPE_PRG;
           newmap->datafile  = NULL;
           newmap->checkfile = newmap->argv[0];
  +        newmap->cachename = NULL;
       }
       else if (strncasecmp(a2, "int:", 4) == 0) {
           newmap->type      = MAPTYPE_INT;
           newmap->datafile  = NULL;
           newmap->checkfile = NULL;
  +        newmap->cachename = NULL;
           newmap->func      = (char *(*)(request_rec *,char *))
                               apr_hash_get(mapfunc_hash, a2+4, strlen(a2+4));
           if ((sconf->state == ENGINE_ENABLED) && (newmap->func == NULL)) {
  @@ -2844,6 +2853,8 @@
           newmap->type      = MAPTYPE_TXT;
           newmap->datafile  = fname;
           newmap->checkfile = fname;
  +        newmap->cachename = apr_psprintf(cmd->pool, "%pp:%s",
  +                                         (void *)cmd->server, a1);
       }
       newmap->fpin  = NULL;
       newmap->fpout = NULL;
  
  
  

Mime
View raw message