From 85137dd2a639bea7424f742cdebd9773ce7a2081 Mon Sep 17 00:00:00 2001 From: Maxim Dounin Date: Tue, 8 Oct 2019 21:56:14 +0300 Subject: [PATCH] Fixed URI normalization with merge_slashes switched off. Previously, "/foo///../bar" was normalized into "/foo/bar" instead of "/foo//bar". --- src/http/ngx_http_parse.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/http/ngx_http_parse.c b/src/http/ngx_http_parse.c index ed5cf7506..aa56b976d 100644 --- a/src/http/ngx_http_parse.c +++ b/src/http/ngx_http_parse.c @@ -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) {