httpd-cvs mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From traw...@apache.org
Subject cvs commit: httpd-2.0/modules/mappers config9.m4 mod_rewrite.c mod_rewrite.h
Date Wed, 21 Aug 2002 19:47:16 GMT
trawick     2002/08/21 12:47:15

  Modified:    .        CHANGES
               modules/mappers config9.m4 mod_rewrite.c mod_rewrite.h
  Log:
  Change mod_rewrite to use apr-util's dbm support for dbm rewrite
  maps.
  
  For now, the SDBM dbm flavor is always used.  It won't be compatible
  with dbm rewrite maps built for Apache 1.3 until apr-util supports
  ndbm and mod_rewrite is changed to prefer ndbm over the built-in
  sdbm.
  
  PR:         10644
  
  Revision  Changes    Path
  1.894     +3 -0      httpd-2.0/CHANGES
  
  Index: CHANGES
  ===================================================================
  RCS file: /home/cvs/httpd-2.0/CHANGES,v
  retrieving revision 1.893
  retrieving revision 1.894
  diff -u -r1.893 -r1.894
  --- CHANGES	21 Aug 2002 17:49:18 -0000	1.893
  +++ CHANGES	21 Aug 2002 19:47:14 -0000	1.894
  @@ -1,5 +1,8 @@
   Changes with Apache 2.0.41
   
  +  *) Change mod_rewrite to use apr-util's dbm support for dbm rewrite
  +     maps.  PR 10644  [Jeff Trawick]
  +
     *) Fixed mod_rewrite's RewriteMap prg: support so that request/response
        pairs will no longer get out of sync with each other.  PR 9534
        [Cliff Woolley]
  
  
  
  1.12      +1 -3      httpd-2.0/modules/mappers/config9.m4
  
  Index: config9.m4
  ===================================================================
  RCS file: /home/cvs/httpd-2.0/modules/mappers/config9.m4,v
  retrieving revision 1.11
  retrieving revision 1.12
  diff -u -r1.11 -r1.12
  --- config9.m4	20 May 2002 21:00:27 -0000	1.11
  +++ config9.m4	21 Aug 2002 19:47:15 -0000	1.12
  @@ -13,9 +13,7 @@
   APACHE_MODULE(userdir, mapping of user requests, , , yes)
   APACHE_MODULE(alias, translation of requests, , , yes)
   
  -APACHE_MODULE(rewrite, regex URL translation, , , most, [
  -  APR_ADDTO(CFLAGS,-DNO_DBM_REWRITEMAP)
  -])
  +APACHE_MODULE(rewrite, regex URL translation, , , most)
   
   dnl mod_so should only be built as a static module
   if test "$enable_so" = "yes"; then
  
  
  
  1.126     +15 -36    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.125
  retrieving revision 1.126
  diff -u -r1.125 -r1.126
  --- mod_rewrite.c	21 Aug 2002 17:49:18 -0000	1.125
  +++ mod_rewrite.c	21 Aug 2002 19:47:15 -0000	1.126
  @@ -120,6 +120,8 @@
   #include "unixd.h"
   #endif
   
  +#define DBM_MAP_TYPE "SDBM"
  +
   /*
   ** +-------------------------------------------------------+
   ** |                                                       |
  @@ -161,23 +163,6 @@
   **         or not!
   */
   
  -    /* The section for the Configure script:
  -    * XXX: this needs updating for apache-2.0 configuration method
  -     * MODULE-DEFINITION-START
  -     * Name: rewrite_module
  -     * ConfigStart
  -    . ./build/find-dbm-lib
  -    if [ "x$found_dbm" = "x1" ]; then
  -        echo "      enabling DBM support for mod_rewrite"
  -    else
  -        echo "      disabling DBM support for mod_rewrite"
  -        echo "      (perhaps you need to add -ldbm, -lndbm or -lgdbm to EXTRA_LIBS)"
  -        CFLAGS="$CFLAGS -DNO_DBM_REWRITEMAP"
  -    fi
  -     * ConfigEnd
  -     * MODULE-DEFINITION-END
  -     */
  -
       /* the module (predeclaration) */
   module AP_MODULE_DECLARE_DATA rewrite_module;
   
  @@ -444,14 +429,12 @@
           newmap->checkfile = a2+4;
       }
       else if (strncmp(a2, "dbm:", 4) == 0) {
  -#ifndef NO_DBM_REWRITEMAP
  +        const char *ignored_fname;
  +
           newmap->type      = MAPTYPE_DBM;
           newmap->datafile  = a2+4;
  -        newmap->checkfile = apr_pstrcat(cmd->pool, a2+4, NDBM_FILE_SUFFIX, NULL);
  -#else
  -        return apr_pstrdup(cmd->pool, "RewriteMap: cannot use NDBM mapfile, "
  -                          "because no NDBM support is compiled in");
  -#endif
  +        apr_dbm_get_usednames_ex(cmd->pool, DBM_MAP_TYPE, newmap->datafile, 
  +                                 &newmap->checkfile, &ignored_fname);
       }
       else if (strncmp(a2, "prg:", 4) == 0) {
           newmap->type      = MAPTYPE_PRG;
  @@ -2789,7 +2772,6 @@
                   }
               }
               else if (s->type == MAPTYPE_DBM) {
  -#ifndef NO_DBM_REWRITEMAP
                   if ((rv = apr_stat(&st, s->checkfile,
                                      APR_FINFO_MIN, r->pool)) != APR_SUCCESS) {
                       ap_log_rerror(APLOG_MARK, APLOG_ERR, rv, r,
  @@ -2825,9 +2807,6 @@
                                  "-> val=%s", s->name, key, value);
                       return value[0] != '\0' ? value : NULL;
                   }
  -#else
  -                return NULL;
  -#endif
               }
               else if (s->type == MAPTYPE_PRG) {
                   if ((value =
  @@ -2946,31 +2925,31 @@
       return value;
   }
   
  -#ifndef NO_DBM_REWRITEMAP
   static char *lookup_map_dbmfile(request_rec *r, const char *file, char *key)
   {
  -    DBM *dbmfp = NULL;
  -    datum dbmkey;
  -    datum dbmval;
  +    apr_dbm_t *dbmfp = NULL;
  +    apr_datum_t dbmkey;
  +    apr_datum_t dbmval;
       char *value = NULL;
       char buf[MAX_STRING_LEN];
  +    apr_status_t rv;
   
       dbmkey.dptr  = key;
       dbmkey.dsize = strlen(key);
  -    if ((dbmfp = dbm_open(file, O_RDONLY, 0666)) != NULL) {
  -        dbmval = dbm_fetch(dbmfp, dbmkey);
  -        if (dbmval.dptr != NULL) {
  +    if ((rv = apr_dbm_open_ex(&dbmfp, DBM_MAP_TYPE, file, APR_DBM_READONLY, 
  +                              0 /* irrelevant when reading */, r->pool)) == APR_SUCCESS)
{
  +        rv = apr_dbm_fetch(dbmfp, dbmkey, &dbmval);
  +        if (rv == APR_SUCCESS) {
               memcpy(buf, dbmval.dptr, 
                      dbmval.dsize < sizeof(buf)-1 ? 
                      dbmval.dsize : sizeof(buf)-1  );
               buf[dbmval.dsize] = '\0';
               value = apr_pstrdup(r->pool, buf);
           }
  -        dbm_close(dbmfp);
  +        apr_dbm_close(dbmfp);
       }
       return value;
   }
  -#endif
   
   static char *lookup_map_program(request_rec *r, apr_file_t *fpin,
                                   apr_file_t *fpout, char *key)
  
  
  
  1.37      +1 -26     httpd-2.0/modules/mappers/mod_rewrite.h
  
  Index: mod_rewrite.h
  ===================================================================
  RCS file: /home/cvs/httpd-2.0/modules/mappers/mod_rewrite.h,v
  retrieving revision 1.36
  retrieving revision 1.37
  diff -u -r1.36 -r1.37
  --- mod_rewrite.h	21 Aug 2002 17:49:18 -0000	1.36
  +++ mod_rewrite.h	21 Aug 2002 19:47:15 -0000	1.37
  @@ -116,6 +116,7 @@
   #include "apr_thread_mutex.h"
   #endif
   #include "apr_optional.h"
  +#include "apr_dbm.h"
   #include "ap_config.h"
   
       /* Include from the Apache server ... */
  @@ -134,28 +135,6 @@
   #define VARY_KEY "rewrite-Vary"
   #define VARY_KEY_THIS "rewrite-Vary-this"
   
  -    /* The NDBM support:
  -     * We support only NDBM files.
  -     * But we have to stat the file for the mtime,
  -     * so we also need to know the file extension
  -     */
  -#ifndef NO_DBM_REWRITEMAP
  -#if defined(__GLIBC__) && defined(__GLIBC_MINOR__) \
  -    && __GLIBC__ >= 2 && __GLIBC_MINOR__ >= 1
  -#include <db1/ndbm.h>
  -#else
  -#include <ndbm.h>
  -#endif
  -#if defined(DBM_SUFFIX)
  -#define NDBM_FILE_SUFFIX DBM_SUFFIX
  -#elif defined(__FreeBSD__) || (defined(DB_LOCK) && defined(DB_SHMEM))
  -#define NDBM_FILE_SUFFIX ".db"
  -#else
  -#define NDBM_FILE_SUFFIX ".pag"
  -#endif
  -#endif
  -
  -
   /*
   **
   **  Some defines
  @@ -164,10 +143,6 @@
   
   #define ENVVAR_SCRIPT_URL "SCRIPT_URL"
   #define ENVVAR_SCRIPT_URI "SCRIPT_URI"
  -
  -#ifndef SUPPORT_DBM_REWRITEMAP
  -#define SUPPORT_DBM_REWRITEMAP 0
  -#endif
   
   #define REWRITE_FORCED_MIMETYPE_NOTEVAR "rewrite-forced-mimetype"
   
  
  
  

Mime
View raw message