aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorIgor Sysoev <igor@sysoev.ru>2009-09-14 07:42:01 +0000
committerIgor Sysoev <igor@sysoev.ru>2009-09-14 07:42:01 +0000
commit97aa4c86a1e6b70f3d48bc9ddad921cbee7ceea5 (patch)
treea03451a18c700550ff3d77a4ed2479782d7e8449
parent12a7d493d49efacd88c1a0dd0bb2e5b4216a801f (diff)
downloadnginx-97aa4c86a1e6b70f3d48bc9ddad921cbee7ceea5.tar.gz
nginx-97aa4c86a1e6b70f3d48bc9ddad921cbee7ceea5.zip
handle "/../" case more reliably
-rw-r--r--src/http/ngx_http_parse.c14
1 files changed, 9 insertions, 5 deletions
diff --git a/src/http/ngx_http_parse.c b/src/http/ngx_http_parse.c
index 9865564e5..d2abaa708 100644
--- a/src/http/ngx_http_parse.c
+++ b/src/http/ngx_http_parse.c
@@ -1134,11 +1134,15 @@ ngx_http_parse_complex_uri(ngx_http_request_t *r, ngx_uint_t merge_slashes)
#endif
case '/':
state = sw_slash;
- u -= 4;
- if (u < r->uri.data) {
- return NGX_HTTP_PARSE_INVALID_REQUEST;
- }
- while (*(u - 1) != '/') {
+ u -= 5;
+ for ( ;; ) {
+ if (u < r->uri.data) {
+ return NGX_HTTP_PARSE_INVALID_REQUEST;
+ }
+ if (*u == '/') {
+ u++;
+ break;
+ }
u--;
}
break;