comparison src/http/ngx_http_parse.c @ 7579:6208c5418c88

Fixed URI normalization with merge_slashes switched off. Previously, "/foo///../bar" was normalized into "/foo/bar" instead of "/foo//bar".
author Maxim Dounin <mdounin@mdounin.ru>
date Tue, 08 Oct 2019 21:56:14 +0300
parents 79bcbe7cd3f2
children 8f55cb5c7e79
comparison
equal deleted inserted replaced
7578:79bcbe7cd3f2 7579:6208c5418c88
1469 case '\\': 1469 case '\\':
1470 #endif 1470 #endif
1471 case '/': 1471 case '/':
1472 case '?': 1472 case '?':
1473 case '#': 1473 case '#':
1474 u -= 5; 1474 u -= 4;
1475 for ( ;; ) { 1475 for ( ;; ) {
1476 if (u < r->uri.data) { 1476 if (u < r->uri.data) {
1477 return NGX_HTTP_PARSE_INVALID_REQUEST; 1477 return NGX_HTTP_PARSE_INVALID_REQUEST;
1478 } 1478 }
1479 if (*u == '/') { 1479 if (*u == '/') {
1573 1573
1574 if (state == sw_dot) { 1574 if (state == sw_dot) {
1575 u--; 1575 u--;
1576 1576
1577 } else if (state == sw_dot_dot) { 1577 } else if (state == sw_dot_dot) {
1578 u -= 5; 1578 u -= 4;
1579 1579
1580 for ( ;; ) { 1580 for ( ;; ) {
1581 if (u < r->uri.data) { 1581 if (u < r->uri.data) {
1582 return NGX_HTTP_PARSE_INVALID_REQUEST; 1582 return NGX_HTTP_PARSE_INVALID_REQUEST;
1583 } 1583 }