-
Notifications
You must be signed in to change notification settings - Fork 1.2k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
mod_headers: Avoid infinite recursion with the edit* action and empty…
… matches. Change the recursion used for edit* to a loop using the new ap_regexec_ex() function taking the current position (offset) in the subject string. After an empty match do the same thing as pcre2_substitute() (or Perl's /g), that is: don't allow for another empty match at the same positition by setting the AP_REG_NOTEMPTY_ATSTART option. If there is a non-empty match use it, otherwise skip/consume the first character and continue from there. * modules/metadata/mod_headers.c: Rename the hdr_edit_r enum for edit* to hdr_edit_all to better express what is does (and since the action is not recursive anymore). * modules/metadata/mod_headers.c(push_string, push_match): New helpers to consume the subject and substitutions in an array of iovec. * modules/metadata/mod_headers.c(process_regexp): Implement the new logic, using push_match() and push_string() to fill the iovec array finally passed to apr_strcatv() for the resulting string. git-svn-id: https://svn.apache.org/repos/asf/httpd/httpd/trunk@1915271 13f79535-47bb-0310-9956-ffa450edef68
- Loading branch information
Showing
2 changed files
with
119 additions
and
31 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,2 @@ | ||
*) mod_headers: Fix a possible infinite recursion with the edit* action and | ||
empty matches. [Yann Ylavic] |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters