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 2023/06/28 14:31:25 UTC
svn commit: r1910666 - /httpd/httpd/trunk/modules/mappers/mod_rewrite.c
Author: covener
Date: Wed Jun 28 14:31:25 2023
New Revision: 1910666
URL: http://svn.apache.org/viewvc?rev=1910666&view=rev
Log:
incorporate feedback from rpluem
update comments, reverse check, force QSL
[skip ci]
Modified:
httpd/httpd/trunk/modules/mappers/mod_rewrite.c
Modified: httpd/httpd/trunk/modules/mappers/mod_rewrite.c
URL: http://svn.apache.org/viewvc/httpd/httpd/trunk/modules/mappers/mod_rewrite.c?rev=1910666&r1=1910665&r2=1910666&view=diff
==============================================================================
--- httpd/httpd/trunk/modules/mappers/mod_rewrite.c (original)
+++ httpd/httpd/trunk/modules/mappers/mod_rewrite.c Wed Jun 28 14:31:25 2023
@@ -3910,13 +3910,16 @@ static const char *cmd_rewriterule(cmd_p
if (*(a2_end-1) == '?') {
/* a literal ? at the end of the unsubstituted rewrite rule */
- if (!(newrule->flags & RULEFLAG_QSAPPEND)) {
- /* trailing ? has done its job. with QSA, splitoutqueryargs
- * will handle it
- */
- *(a2_end-1) = '\0';
- newrule->flags |= RULEFLAG_QSNONE;
+ if (newrule->flags & RULEFLAG_QSAPPEND) {
+ /* with QSA, splitoutqueryargs will safely handle it if RULEFLAG_QSLAST is set */
+ newrule->flags |= RULEFLAG_QSLAST;
}
+ else {
+ /* avoid getting a a query string via inadvertent capture */
+ newrule->flags |= RULEFLAG_QSNONE;
+ /* trailing ? has done its job, but splitoutqueryargs will not chop it off */
+ *(a2_end-1) = '\0';
+ }
}
else if (newrule->flags & RULEFLAG_QSDISCARD) {
if (NULL == ap_strchr(newrule->output, '?')) {