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 2020/02/12 13:36:41 UTC

svn commit: r1873941 - in /httpd/httpd/trunk: include/ap_mmn.h include/ap_regex.h modules/filters/mod_substitute.c server/util_pcre.c server/util_regex.c

Author: covener
Date: Wed Feb 12 13:36:40 2020
New Revision: 1873941

URL: http://svn.apache.org/viewvc?rev=1873941&view=rev
Log:
don't use DOTALL from mod_substitute which leaves \n at the end of the line.

Modified:
    httpd/httpd/trunk/include/ap_mmn.h
    httpd/httpd/trunk/include/ap_regex.h
    httpd/httpd/trunk/modules/filters/mod_substitute.c
    httpd/httpd/trunk/server/util_pcre.c
    httpd/httpd/trunk/server/util_regex.c

Modified: httpd/httpd/trunk/include/ap_mmn.h
URL: http://svn.apache.org/viewvc/httpd/httpd/trunk/include/ap_mmn.h?rev=1873941&r1=1873940&r2=1873941&view=diff
==============================================================================
--- httpd/httpd/trunk/include/ap_mmn.h (original)
+++ httpd/httpd/trunk/include/ap_mmn.h Wed Feb 12 13:36:40 2020
@@ -620,6 +620,7 @@
  * 20190312.6 (2.5.1-dev)  Add proxy check_trans hook
  * 20190312.7 (2.5.1-dev)  AP_REG_DEFAULT macro in ap_regex.h
  * 20190312.8 (2.5.1-dev)  ap_is_chunked() in httpd.h
+ * 20190312.9 (2.5.1-dev)  AP_REG_NO_DOTALL macro in ap_regex.h
  */
 
 #define MODULE_MAGIC_COOKIE 0x41503235UL /* "AP25" */
@@ -627,7 +628,7 @@
 #ifndef MODULE_MAGIC_NUMBER_MAJOR
 #define MODULE_MAGIC_NUMBER_MAJOR 20190312
 #endif
-#define MODULE_MAGIC_NUMBER_MINOR 8              /* 0...n */
+#define MODULE_MAGIC_NUMBER_MINOR 9            /* 0...n */
 
 /**
  * Determine if the server's current MODULE_MAGIC_NUMBER is at least a

Modified: httpd/httpd/trunk/include/ap_regex.h
URL: http://svn.apache.org/viewvc/httpd/httpd/trunk/include/ap_regex.h?rev=1873941&r1=1873940&r2=1873941&view=diff
==============================================================================
--- httpd/httpd/trunk/include/ap_regex.h (original)
+++ httpd/httpd/trunk/include/ap_regex.h Wed Feb 12 13:36:40 2020
@@ -87,6 +87,8 @@ extern "C" {
 
 #define AP_REG_DOLLAR_ENDONLY 0x200 /**< '$' matches at end of subject string only */
 
+#define AP_REG_NO_DOTALL 0x400 /**< remove AP_REG_DOTALL from defaults */
+
 #define AP_REG_MATCH "MATCH_" /**< suggested prefix for ap_regname */
 
 #define AP_REG_DEFAULT (AP_REG_DOTALL|AP_REG_DOLLAR_ENDONLY)

Modified: httpd/httpd/trunk/modules/filters/mod_substitute.c
URL: http://svn.apache.org/viewvc/httpd/httpd/trunk/modules/filters/mod_substitute.c?rev=1873941&r1=1873940&r2=1873941&view=diff
==============================================================================
--- httpd/httpd/trunk/modules/filters/mod_substitute.c (original)
+++ httpd/httpd/trunk/modules/filters/mod_substitute.c Wed Feb 12 13:36:40 2020
@@ -716,7 +716,7 @@ static const char *set_pattern(cmd_parms
 
     /* first see if we can compile the regex */
     if (!is_pattern) {
-        r = ap_pregcomp(cmd->pool, from, AP_REG_EXTENDED |
+        r = ap_pregcomp(cmd->pool, from, AP_REG_NO_DOTALL | AP_REG_EXTENDED |
                         (ignore_case ? AP_REG_ICASE : 0));
         if (!r)
             return "Substitute could not compile regex";

Modified: httpd/httpd/trunk/server/util_pcre.c
URL: http://svn.apache.org/viewvc/httpd/httpd/trunk/server/util_pcre.c?rev=1873941&r1=1873940&r2=1873941&view=diff
==============================================================================
--- httpd/httpd/trunk/server/util_pcre.c (original)
+++ httpd/httpd/trunk/server/util_pcre.c Wed Feb 12 13:36:40 2020
@@ -179,6 +179,9 @@ AP_DECLARE(int) ap_regcomp_default_cflag
     else if (ap_cstr_casecmp(name, "DOTALL") == 0) {
         cflag = AP_REG_DOTALL;
     }
+    else if (ap_cstr_casecmp(name, "NO_DOTALL") == 0) {
+        cflag = AP_REG_NO_DOTALL;
+    }
     else if (ap_cstr_casecmp(name, "DOLLAR_ENDONLY") == 0) {
         cflag = AP_REG_DOLLAR_ENDONLY;
     }
@@ -217,6 +220,8 @@ AP_DECLARE(int) ap_regcomp(ap_regex_t *
         options |= PCREn(MULTILINE);
     if ((cflags & AP_REG_DOTALL) != 0)
         options |= PCREn(DOTALL);
+    if ((cflags & AP_REG_NO_DOTALL) != 0)
+        options &= ~PCREn(DOTALL);
     if ((cflags & AP_REG_DOLLAR_ENDONLY) != 0)
         options |= PCREn(DOLLAR_ENDONLY);
 

Modified: httpd/httpd/trunk/server/util_regex.c
URL: http://svn.apache.org/viewvc/httpd/httpd/trunk/server/util_regex.c?rev=1873941&r1=1873940&r2=1873941&view=diff
==============================================================================
--- httpd/httpd/trunk/server/util_regex.c (original)
+++ httpd/httpd/trunk/server/util_regex.c Wed Feb 12 13:36:40 2020
@@ -101,6 +101,7 @@ AP_DECLARE(ap_rxplus_t*) ap_rxplus_compi
         case 'n': ret->flags |= AP_REG_NOMEM; break;
         case 'g': ret->flags |= AP_REG_MULTI; break;
         case 's': ret->flags |= AP_REG_DOTALL; break;
+        case 'S': ret->flags |= AP_REG_NO_DOTALL; break;
         case '^': ret->flags |= AP_REG_NOTBOL; break;
         case '$': ret->flags |= AP_REG_NOTEOL; break;
         default: break; /* we should probably be stricter here */