]> granicus.if.org Git - apache/commitdiff
Get mod_rewrite to work as a DSO by changing the way it
authorJeff Trawick <trawick@apache.org>
Wed, 13 Dec 2000 13:03:32 +0000 (13:03 +0000)
committerJeff Trawick <trawick@apache.org>
Wed, 13 Dec 2000 13:03:32 +0000 (13:03 +0000)
keeps track of whether or not its post config hook has
been called before.  Instead of a static variable (which
is replaced when the DSO is loaded a second time), use
userdata in the process pool.

git-svn-id: https://svn.apache.org/repos/asf/httpd/httpd/trunk@87328 13f79535-47bb-0310-9956-ffa450edef68

modules/mappers/mod_rewrite.c

index 038c79c79d2b9e437a21fba5646178a9395d75ac..5cb5b877643eae49ae371d01052251b9f069db04 100644 (file)
@@ -243,7 +243,6 @@ static cache *cachep;
 
     /* whether proxy module is available or not */
 static int proxy_available;
-static int once_through = 0;
 
 static const char *lockname;
 static apr_lock_t *rewrite_mapr_lock = NULL;
@@ -989,6 +988,16 @@ static void init_module(apr_pool_t *p,
                         server_rec *s)
 {
     apr_status_t rv;
+    void *data;
+    int first_time = 0;
+    const char *userdata_key = "rewrite_init_module";
+
+    apr_get_userdata(&data, userdata_key, s->process->pool);
+    if (!data) {
+        first_time = 1;
+        apr_set_userdata((const void *)1, userdata_key,
+                         apr_null_cleanup, s->process->pool);
+    }
 
     /* check if proxy module is available */
     proxy_available = (ap_find_linked_module("mod_proxy.c") != NULL);
@@ -1010,11 +1019,9 @@ static void init_module(apr_pool_t *p,
      */
     for (; s; s = s->next) {
         open_rewritelog(s, p);
-        if (once_through > 0)
+        if (!first_time)
            run_rewritemap_programs(s, p);
     }
-
-    once_through++;
 }