Fixed URI normalization with merge_slashes switched off.

Previously, "/foo///../bar" was normalized into "/foo/bar"
instead of "/foo//bar".
This commit is contained in:
Maxim Dounin 2019-10-08 21:56:14 +03:00
parent ed42131da6
commit 85137dd2a6

View 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) {