summaryrefslogtreecommitdiffhomepage
path: root/src/http/ngx_http_parse.c
diff options
context:
space:
mode:
authorIgor Sysoev <igor@sysoev.ru>2009-09-07 09:29:41 +0000
committerIgor Sysoev <igor@sysoev.ru>2009-09-07 09:29:41 +0000
commitc8cee16ad74140424eb9758e1bc9dae35f3e5ef2 (patch)
treebb08b0314c5e41f7c78bdf3ab104c7fa3c3e6349 /src/http/ngx_http_parse.c
parent255546c802cbc3634660657fb72e1faa63b51121 (diff)
downloadnginx-c8cee16ad74140424eb9758e1bc9dae35f3e5ef2.tar.gz
nginx-c8cee16ad74140424eb9758e1bc9dae35f3e5ef2.tar.bz2
handle "/../" case more reliably
Diffstat (limited to 'src/http/ngx_http_parse.c')
-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 eda2cd842..0b7356598 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;