diff options
author | Eric Covener <covener@apache.org> | 2018-05-17 14:28:59 +0200 |
---|---|---|
committer | Eric Covener <covener@apache.org> | 2018-05-17 14:28:59 +0200 |
commit | 826975e9cf5f006144398b1375b69921a4550c51 (patch) | |
tree | 079de28500d0be7a7ba2b92fa341064a57dedaf2 /modules/mappers | |
parent | PR62368: Print the unparsed URI in AH03454 (diff) | |
download | apache2-826975e9cf5f006144398b1375b69921a4550c51.tar.xz apache2-826975e9cf5f006144398b1375b69921a4550c51.zip |
PR62311: only create the rewritelock when needed
Submitted By: Hank Ibell <hwibell gmail.com>
Committed By: covener
git-svn-id: https://svn.apache.org/repos/asf/httpd/httpd/trunk@1831773 13f79535-47bb-0310-9956-ffa450edef68
Diffstat (limited to 'modules/mappers')
-rw-r--r-- | modules/mappers/mod_rewrite.c | 21 |
1 files changed, 12 insertions, 9 deletions
diff --git a/modules/mappers/mod_rewrite.c b/modules/mappers/mod_rewrite.c index 0b6c41ab27..2066f932c1 100644 --- a/modules/mappers/mod_rewrite.c +++ b/modules/mappers/mod_rewrite.c @@ -422,6 +422,7 @@ static cache *cachep; static int proxy_available; /* Locks/Mutexes */ +static int rewrite_lock_needed = 0; static apr_global_mutex_t *rewrite_mapr_lock_acquire = NULL; static const char *rewritemap_mutex_type = "rewrite-map"; @@ -2691,9 +2692,6 @@ static apr_status_t rewritelock_create(server_rec *s, apr_pool_t *p) apr_status_t rc; /* create the lockfile */ - /* XXX See if there are any rewrite map programs before creating - * the mutex. - */ rc = ap_global_mutex_create(&rewrite_mapr_lock_acquire, NULL, rewritemap_mutex_type, NULL, s, p, 0); if (rc != APR_SUCCESS) { @@ -3180,6 +3178,8 @@ static const char *cmd_rewritemap(cmd_parms *cmd, void *dconf, const char *a1, newmap->type = MAPTYPE_PRG; newmap->checkfile = newmap->argv[0]; + rewrite_lock_needed = 1; + if (a3) { char *tok_cntx; newmap->user = apr_strtok(apr_pstrdup(cmd->pool, a3), ":", &tok_cntx); @@ -4502,6 +4502,7 @@ static int pre_config(apr_pool_t *pconf, { APR_OPTIONAL_FN_TYPE(ap_register_rewrite_mapfunc) *map_pfn_register; + rewrite_lock_needed = 0; ap_mutex_register(pconf, rewritemap_mutex_type, NULL, APR_LOCK_DEFAULT, 0); /* register int: rewritemap handlers */ @@ -4527,13 +4528,15 @@ static int post_config(apr_pool_t *p, /* check if proxy module is available */ proxy_available = (ap_find_linked_module("mod_proxy.c") != NULL); - rv = rewritelock_create(s, p); - if (rv != APR_SUCCESS) { - return HTTP_INTERNAL_SERVER_ERROR; - } + if (rewrite_lock_needed) { + rv = rewritelock_create(s, p); + if (rv != APR_SUCCESS) { + return HTTP_INTERNAL_SERVER_ERROR; + } - apr_pool_cleanup_register(p, (void *)s, rewritelock_remove, - apr_pool_cleanup_null); + apr_pool_cleanup_register(p, (void *)s, rewritelock_remove, + apr_pool_cleanup_null); + } /* if we are not doing the initial config, step through the servers and * open the RewriteMap prg:xxx programs, |