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