changeset 3571:67394153ec39

fix "/dir/%3F../" and "/dir/%23../" cases
author Igor Sysoev <igor@sysoev.ru>
date Fri, 04 Jun 2010 16:05:55 +0000
parents e03b8a4fb906
children 4846ec9f83cb
files src/http/ngx_http_parse.c
diffstat 1 files changed, 3 insertions(+), 6 deletions(-) [+]
line wrap: on
line diff
--- a/src/http/ngx_http_parse.c
+++ b/src/http/ngx_http_parse.c
@@ -1187,16 +1187,11 @@ ngx_http_parse_complex_uri(ngx_http_requ
             if (ch >= '0' && ch <= '9') {
                 ch = (u_char) ((decoded << 4) + ch - '0');
 
-                if (ch == '%') {
+                if (ch == '%' || ch == '#') {
                     state = sw_usual;
                     *u++ = ch;
                     ch = *p++;
                     break;
-                }
-
-                if (ch == '#') {
-                    *u++ = ch;
-                    ch = *p++;
 
                 } else if (ch == '\0') {
                     return NGX_HTTP_PARSE_INVALID_REQUEST;
@@ -1211,8 +1206,10 @@ ngx_http_parse_complex_uri(ngx_http_requ
                 ch = (u_char) ((decoded << 4) + c - 'a' + 10);
 
                 if (ch == '?') {
+                    state = sw_usual;
                     *u++ = ch;
                     ch = *p++;
+                    break;
 
                 } else if (ch == '+') {
                     r->plus_in_uri = 1;