From: Christophe Jaillet Date: Sat, 14 Nov 2020 12:46:38 +0000 (+0000) Subject: Save a few cycles. X-Git-Tag: 2.5.0-alpha2-ci-test-only~1147 X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=b2b57c3183430a427ecef986e560d8d25db144f1;p=thirdparty%2Fapache%2Fhttpd.git Save a few cycles. 'is_absolute_uri()' returns the length of the prefix, so there is no need to scan these bytes when looking for a '?' character git-svn-id: https://svn.apache.org/repos/asf/httpd/httpd/trunk@1883421 13f79535-47bb-0310-9956-ffa450edef68 --- diff --git a/modules/mappers/mod_rewrite.c b/modules/mappers/mod_rewrite.c index 5a38ad03e0f..8ce84f44df0 100644 --- a/modules/mappers/mod_rewrite.c +++ b/modules/mappers/mod_rewrite.c @@ -797,23 +797,23 @@ static void splitout_queryargs(request_rec *r, int qsappend, int qsdiscard, int qslast) { char *q; - int split; + int split, skip; /* don't touch, unless it's a scheme for which a query string makes sense. * See RFC 1738 and RFC 2368. */ - if (is_absolute_uri(r->filename, &split) + if ((skip = is_absolute_uri(r->filename, &split)) && !split) { r->args = NULL; /* forget the query that's still flying around */ return; } - if ( qsdiscard ) { + if (qsdiscard) { r->args = NULL; /* Discard query string */ rewritelog(r, 2, NULL, "discarding query string"); } - q = qslast ? ap_strrchr(r->filename, '?') : ap_strchr(r->filename, '?'); + q = qslast ? ap_strrchr(r->filename + skip, '?') : ap_strchr(r->filename + skip, '?'); if (q != NULL) { char *olduri; @@ -844,8 +844,6 @@ static void splitout_queryargs(request_rec *r, int qsappend, int qsdiscard, rewritelog(r, 3, NULL, "split uri=%s -> uri=%s, args=%s", olduri, r->filename, r->args ? r->args : ""); } - - return; } /*