You are viewing a plain text version of this content. The canonical link for it is here.
Posted to cvs@httpd.apache.org by yl...@apache.org on 2020/06/23 12:25:57 UTC

svn commit: r1879117 - /httpd/httpd/trunk/server/request.c

Author: ylavic
Date: Tue Jun 23 12:25:56 2020
New Revision: 1879117

URL: http://svn.apache.org/viewvc?rev=1879117&view=rev
Log:
Follow up to r1879079: merge slashes (if configured to) before pre_trans

There are few cases (if any) where multiple slashes have different semantics
than a single one, and it's always been like that for proxy_trans anyway.

This allows for better directory/location/if walk caching and is less confusing
for their users.

Modified:
    httpd/httpd/trunk/server/request.c

Modified: httpd/httpd/trunk/server/request.c
URL: http://svn.apache.org/viewvc/httpd/httpd/trunk/server/request.c?rev=1879117&r1=1879116&r2=1879117&view=diff
==============================================================================
--- httpd/httpd/trunk/server/request.c (original)
+++ httpd/httpd/trunk/server/request.c Tue Jun 23 12:25:56 2020
@@ -196,7 +196,10 @@ AP_DECLARE(int) ap_process_request_inter
 
     if (file_req) {
         /* File subrequests can have a relative path. */
-        normalize_flags = AP_NORMALIZE_ALLOW_RELATIVE;
+        normalize_flags |= AP_NORMALIZE_ALLOW_RELATIVE;
+    }
+    if (sconf->merge_slashes != AP_CORE_CONFIG_OFF) { 
+        normalize_flags |= AP_NORMALIZE_MERGE_SLASHES;
     }
 
     if (r->parsed_uri.path) {
@@ -259,19 +262,11 @@ AP_DECLARE(int) ap_process_request_inter
         }
 
         if (d->allow_encoded_slashes && d->decode_encoded_slashes) {
-            /* Decoding slashes might have created new /./ and /../
-             * segments (e.g. "/.%2F/"), so re-normalize. If asked to,
-             * merge slashes while at it.
+            /* Decoding slashes might have created new // or /./ or /../
+             * segments (e.g. "/.%2F/"), so re-normalize.
              */
-            if (sconf->merge_slashes != AP_CORE_CONFIG_OFF) { 
-                normalize_flags |= AP_NORMALIZE_MERGE_SLASHES;
-            }
             ap_normalize_path(r->parsed_uri.path, normalize_flags);
         }
-        else if (sconf->merge_slashes != AP_CORE_CONFIG_OFF) { 
-            /* We still didn't merged slashes yet, do it now. */
-            ap_no2slash(r->parsed_uri.path);
-        }
     }
 
     /* Same, translate_name is not suited for file subrequests */