]> git.ipfire.org Git - thirdparty/apache/httpd.git/commitdiff
Save a few cycles.
authorChristophe Jaillet <jailletc36@apache.org>
Sat, 14 Nov 2020 12:46:38 +0000 (12:46 +0000)
committerChristophe Jaillet <jailletc36@apache.org>
Sat, 14 Nov 2020 12:46:38 +0000 (12:46 +0000)
'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

modules/mappers/mod_rewrite.c

index 5a38ad03e0f439907fff041ed49b7989ea80b49d..8ce84f44df0a098a4294656fc4b800681bc28b02 100644 (file)
@@ -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 : "<none>");
     }
-
-    return;
 }
 
 /*