|
|
e8122d |
diff --git a/include/ap_regex.h b/include/ap_regex.h
|
|
|
e8122d |
index 7d8df79..7af2f99 100644
|
|
|
e8122d |
--- a/include/ap_regex.h
|
|
|
e8122d |
+++ b/include/ap_regex.h
|
|
|
e8122d |
@@ -84,7 +84,11 @@ extern "C" {
|
|
|
e8122d |
|
|
|
e8122d |
#define AP_REG_DOLLAR_ENDONLY 0x200 /* '$' matches at end of subject string only */
|
|
|
e8122d |
|
|
|
e8122d |
-#define AP_REG_MATCH "MATCH_" /** suggested prefix for ap_regname */
|
|
|
e8122d |
+#define AP_REG_NO_DEFAULT 0x400 /**< Don't implicitely add AP_REG_DEFAULT options */
|
|
|
e8122d |
+
|
|
|
e8122d |
+#define AP_REG_MATCH "MATCH_" /**< suggested prefix for ap_regname */
|
|
|
e8122d |
+
|
|
|
e8122d |
+#define AP_REG_DEFAULT (AP_REG_DOTALL|AP_REG_DOLLAR_ENDONLY)
|
|
|
e8122d |
|
|
|
e8122d |
/* Error values: */
|
|
|
e8122d |
enum {
|
|
|
e8122d |
diff --git a/modules/filters/mod_substitute.c b/modules/filters/mod_substitute.c
|
|
|
e8122d |
index b7d5296..e976c51 100644
|
|
|
e8122d |
--- a/modules/filters/mod_substitute.c
|
|
|
e8122d |
+++ b/modules/filters/mod_substitute.c
|
|
|
e8122d |
@@ -667,8 +667,10 @@ static const char *set_pattern(cmd_parms *cmd, void *cfg, const char *line)
|
|
|
e8122d |
|
|
|
e8122d |
/* first see if we can compile the regex */
|
|
|
e8122d |
if (!is_pattern) {
|
|
|
e8122d |
- r = ap_pregcomp(cmd->pool, from, AP_REG_EXTENDED |
|
|
|
e8122d |
- (ignore_case ? AP_REG_ICASE : 0));
|
|
|
e8122d |
+ int flags = AP_REG_NO_DEFAULT
|
|
|
e8122d |
+ | (ap_regcomp_get_default_cflags() & AP_REG_DOLLAR_ENDONLY)
|
|
|
e8122d |
+ | (ignore_case ? AP_REG_ICASE : 0);
|
|
|
e8122d |
+ r = ap_pregcomp(cmd->pool, from, flags);
|
|
|
e8122d |
if (!r)
|
|
|
e8122d |
return "Substitute could not compile regex";
|
|
|
e8122d |
}
|
|
|
e8122d |
diff --git a/server/core.c b/server/core.c
|
|
|
e8122d |
index 9d1b973..8011698 100644
|
|
|
e8122d |
--- a/server/core.c
|
|
|
e8122d |
+++ b/server/core.c
|
|
|
e8122d |
@@ -4970,7 +4970,7 @@ static int core_pre_config(apr_pool_t *pconf, apr_pool_t *plog, apr_pool_t *ptem
|
|
|
e8122d |
init_config_defines(pconf);
|
|
|
e8122d |
apr_pool_cleanup_register(pconf, NULL, reset_config, apr_pool_cleanup_null);
|
|
|
e8122d |
|
|
|
e8122d |
- ap_regcomp_set_default_cflags(AP_REG_DOLLAR_ENDONLY);
|
|
|
e8122d |
+ ap_regcomp_set_default_cflags(AP_REG_DEFAULT);
|
|
|
e8122d |
|
|
|
e8122d |
mpm_common_pre_config(pconf);
|
|
|
e8122d |
|
|
|
e8122d |
diff --git a/server/util_pcre.c b/server/util_pcre.c
|
|
|
e8122d |
index f2cb1bb..2a665c8 100644
|
|
|
e8122d |
--- a/server/util_pcre.c
|
|
|
e8122d |
+++ b/server/util_pcre.c
|
|
|
e8122d |
@@ -120,7 +120,7 @@ AP_DECLARE(void) ap_regfree(ap_regex_t *preg)
|
|
|
e8122d |
* Compile a regular expression *
|
|
|
e8122d |
*************************************************/
|
|
|
e8122d |
|
|
|
e8122d |
-static int default_cflags = AP_REG_DOLLAR_ENDONLY;
|
|
|
e8122d |
+static int default_cflags = AP_REG_DEFAULT;
|
|
|
e8122d |
|
|
|
e8122d |
AP_DECLARE(int) ap_regcomp_get_default_cflags(void)
|
|
|
e8122d |
{
|
|
|
e8122d |
@@ -168,7 +168,8 @@ AP_DECLARE(int) ap_regcomp(ap_regex_t * preg, const char *pattern, int cflags)
|
|
|
e8122d |
int errcode = 0;
|
|
|
e8122d |
int options = PCRE_DUPNAMES;
|
|
|
e8122d |
|
|
|
e8122d |
- cflags |= default_cflags;
|
|
|
e8122d |
+ if ((cflags & AP_REG_NO_DEFAULT) == 0)
|
|
|
e8122d |
+ cflags |= default_cflags;
|
|
|
e8122d |
if ((cflags & AP_REG_ICASE) != 0)
|
|
|
e8122d |
options |= PCRE_CASELESS;
|
|
|
e8122d |
if ((cflags & AP_REG_NEWLINE) != 0)
|
|
|
e8122d |
diff --git a/server/util_regex.c b/server/util_regex.c
|
|
|
e8122d |
index 2a30d68..5405f8d 100644
|
|
|
e8122d |
--- a/server/util_regex.c
|
|
|
e8122d |
+++ b/server/util_regex.c
|
|
|
e8122d |
@@ -94,6 +94,7 @@ AP_DECLARE(ap_rxplus_t*) ap_rxplus_compile(apr_pool_t *pool,
|
|
|
e8122d |
}
|
|
|
e8122d |
|
|
|
e8122d |
/* anything after the current delimiter is flags */
|
|
|
e8122d |
+ ret->flags = ap_regcomp_get_default_cflags() & AP_REG_DOLLAR_ENDONLY;
|
|
|
e8122d |
while (*++endp) {
|
|
|
e8122d |
switch (*endp) {
|
|
|
e8122d |
case 'i': ret->flags |= AP_REG_ICASE; break;
|
|
|
e8122d |
@@ -106,7 +107,7 @@ AP_DECLARE(ap_rxplus_t*) ap_rxplus_compile(apr_pool_t *pool,
|
|
|
e8122d |
default: break; /* we should probably be stricter here */
|
|
|
e8122d |
}
|
|
|
e8122d |
}
|
|
|
e8122d |
- if (ap_regcomp(&ret->rx, rxstr, ret->flags) == 0) {
|
|
|
e8122d |
+ if (ap_regcomp(&ret->rx, rxstr, AP_REG_NO_DEFAULT | ret->flags) == 0) {
|
|
|
e8122d |
apr_pool_cleanup_register(pool, &ret->rx, rxplus_cleanup,
|
|
|
e8122d |
apr_pool_cleanup_null);
|
|
|
e8122d |
}
|