int qsdiscard = flags & RULEFLAG_QSDISCARD;
int qslast = flags & RULEFLAG_QSLAST;
+ if (flags & RULEFLAG_QSNONE) {
+ rewritelog(r, 2, NULL, "discarding query string, no parse from substitution");
+ r->args = NULL;
+ return;
+ }
+
/* don't touch, unless it's a scheme for which a query string makes sense.
* See RFC 1738 and RFC 2368.
*/
r->args[len-1] = '\0';
}
}
- if (flags & RULEFLAG_QSNONE) {
- rewritelog(r, 2, NULL, "discarding query string, no parse from substitution");
- r->args = NULL;
- }
rewritelog(r, 3, NULL, "split uri=%s -> uri=%s, args=%s", olduri,
r->filename, r->args ? r->args : "<none>");
}
if (*(a2_end-1) == '?') {
- if (!(newrule->flags & RULEFLAG_QSAPPEND) &&
- !(newrule->flags & RULEFLAG_QSLAST)) {
- /* Rule ends with a literal ?, make sure we don't end up with any query */
+ *(a2_end-1) = '\0'; /* trailing ? has done its job */
+ /* a literal ? at the end of the unsubstituted rewrite rule */
+ if (!(newrule->flags & RULEFLAG_QSAPPEND))
+ {
newrule->flags |= RULEFLAG_QSNONE;
}
}
else if (newrule->flags & RULEFLAG_QSDISCARD) {
if (NULL == ap_strchr(newrule->output, '?')) {
- /* QSD and no literal ? in substitution, make sure we don't end up with any query */
newrule->flags |= RULEFLAG_QSNONE;
}
}