Skip to content

Commit 5b6275f

Browse files
committed
incorporate feedback from rpluem
update comments, reverse check, force QSL [skip ci] git-svn-id: https://svn.apache.org/repos/asf/httpd/httpd/trunk@1910666 13f79535-47bb-0310-9956-ffa450edef68
1 parent 49f3a9c commit 5b6275f

File tree

1 file changed

+9
-6
lines changed

1 file changed

+9
-6
lines changed

modules/mappers/mod_rewrite.c

+9-6
Original file line numberDiff line numberDiff line change
@@ -3910,13 +3910,16 @@ static const char *cmd_rewriterule(cmd_parms *cmd, void *in_dconf,
39103910

39113911
if (*(a2_end-1) == '?') {
39123912
/* a literal ? at the end of the unsubstituted rewrite rule */
3913-
if (!(newrule->flags & RULEFLAG_QSAPPEND)) {
3914-
/* trailing ? has done its job. with QSA, splitoutqueryargs
3915-
* will handle it
3916-
*/
3917-
*(a2_end-1) = '\0';
3918-
newrule->flags |= RULEFLAG_QSNONE;
3913+
if (newrule->flags & RULEFLAG_QSAPPEND) {
3914+
/* with QSA, splitoutqueryargs will safely handle it if RULEFLAG_QSLAST is set */
3915+
newrule->flags |= RULEFLAG_QSLAST;
39193916
}
3917+
else {
3918+
/* avoid getting a a query string via inadvertent capture */
3919+
newrule->flags |= RULEFLAG_QSNONE;
3920+
/* trailing ? has done its job, but splitoutqueryargs will not chop it off */
3921+
*(a2_end-1) = '\0';
3922+
}
39203923
}
39213924
else if (newrule->flags & RULEFLAG_QSDISCARD) {
39223925
if (NULL == ap_strchr(newrule->output, '?')) {

0 commit comments

Comments
 (0)