You are viewing a plain text version of this content. The canonical link for it is here.
Posted to cvs@httpd.apache.org by co...@apache.org on 2018/05/17 12:28:59 UTC
svn commit: r1831773 - in /httpd/httpd/trunk: CHANGES
modules/mappers/mod_rewrite.c
Author: covener
Date: Thu May 17 12:28:59 2018
New Revision: 1831773
URL: http://svn.apache.org/viewvc?rev=1831773&view=rev
Log:
PR62311: only create the rewritelock when needed
Submitted By: Hank Ibell <hwibell gmail.com>
Committed By: covener
Modified:
httpd/httpd/trunk/CHANGES
httpd/httpd/trunk/modules/mappers/mod_rewrite.c
Modified: httpd/httpd/trunk/CHANGES
URL: http://svn.apache.org/viewvc/httpd/httpd/trunk/CHANGES?rev=1831773&r1=1831772&r2=1831773&view=diff
==============================================================================
--- httpd/httpd/trunk/CHANGES [utf-8] (original)
+++ httpd/httpd/trunk/CHANGES [utf-8] Thu May 17 12:28:59 2018
@@ -1,6 +1,10 @@
-*- coding: utf-8 -*-
Changes with Apache 2.5.1
+ *) mod_rewrite: Only create the global mutex used by "RewriteMap prg:" when
+ this type of map is present in the configuration. PR62311.
+ [Hank Ibell <hwibell gmail.com>]
+
*) mod_ldap: Abort on LDAP locking errors. [Eric Covener]
*) mod_ssl: Support loading certificates and private keys from the
Modified: httpd/httpd/trunk/modules/mappers/mod_rewrite.c
URL: http://svn.apache.org/viewvc/httpd/httpd/trunk/modules/mappers/mod_rewrite.c?rev=1831773&r1=1831772&r2=1831773&view=diff
==============================================================================
--- httpd/httpd/trunk/modules/mappers/mod_rewrite.c (original)
+++ httpd/httpd/trunk/modules/mappers/mod_rewrite.c Thu May 17 12:28:59 2018
@@ -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(s
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_pa
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,