]> git.kaiwu.me - nginx.git/commitdiff
Fixed URI normalization with merge_slashes switched off.
authorMaxim Dounin <mdounin@mdounin.ru>
Tue, 8 Oct 2019 18:56:14 +0000 (21:56 +0300)
committerMaxim Dounin <mdounin@mdounin.ru>
Tue, 8 Oct 2019 18:56:14 +0000 (21:56 +0300)
Previously, "/foo///../bar" was normalized into "/foo/bar"
instead of "/foo//bar".

src/http/ngx_http_parse.c

index ed5cf75060aa98be115d16f2b50d200cc02e665c..aa56b976df355db38b9c062ef6751a5568997973 100644 (file)
@@ -1471,7 +1471,7 @@ ngx_http_parse_complex_uri(ngx_http_request_t *r, ngx_uint_t merge_slashes)
             case '/':
             case '?':
             case '#':
-                u -= 5;
+                u -= 4;
                 for ( ;; ) {
                     if (u < r->uri.data) {
                         return NGX_HTTP_PARSE_INVALID_REQUEST;
@@ -1575,7 +1575,7 @@ ngx_http_parse_complex_uri(ngx_http_request_t *r, ngx_uint_t merge_slashes)
         u--;
 
     } else if (state == sw_dot_dot) {
-        u -= 5;
+        u -= 4;
 
         for ( ;; ) {
             if (u < r->uri.data) {