aboutsummaryrefslogtreecommitdiff
path: root/src/http/ngx_http_parse.c
diff options
context:
space:
mode:
authorIgor Sysoev <igor@sysoev.ru>2010-05-24 12:35:10 +0000
committerIgor Sysoev <igor@sysoev.ru>2010-05-24 12:35:10 +0000
commitde0b1d6f12e67e543627d8da4aa0aac739f143af (patch)
tree05ea9e2687d1b32054c26f7666b3f740a016dc97 /src/http/ngx_http_parse.c
parent9b2763a245e51032734089672a8a74611a288fae (diff)
downloadnginx-de0b1d6f12e67e543627d8da4aa0aac739f143af.tar.gz
nginx-de0b1d6f12e67e543627d8da4aa0aac739f143af.zip
remove r->zero_in_uri
Diffstat (limited to 'src/http/ngx_http_parse.c')
-rw-r--r--src/http/ngx_http_parse.c49
1 files changed, 15 insertions, 34 deletions
diff --git a/src/http/ngx_http_parse.c b/src/http/ngx_http_parse.c
index b638f86fc..2952e02ea 100644
--- a/src/http/ngx_http_parse.c
+++ b/src/http/ngx_http_parse.c
@@ -438,8 +438,7 @@ ngx_http_parse_request_line(ngx_http_request_t *r, ngx_buf_t *b)
r->plus_in_uri = 1;
break;
case '\0':
- r->zero_in_uri = 1;
- break;
+ return NGX_HTTP_PARSE_INVALID_REQUEST;
default:
state = sw_check_uri;
break;
@@ -496,8 +495,7 @@ ngx_http_parse_request_line(ngx_http_request_t *r, ngx_buf_t *b)
r->plus_in_uri = 1;
break;
case '\0':
- r->zero_in_uri = 1;
- break;
+ return NGX_HTTP_PARSE_INVALID_REQUEST;
}
break;
@@ -526,8 +524,7 @@ ngx_http_parse_request_line(ngx_http_request_t *r, ngx_buf_t *b)
r->complex_uri = 1;
break;
case '\0':
- r->zero_in_uri = 1;
- break;
+ return NGX_HTTP_PARSE_INVALID_REQUEST;
}
break;
@@ -1202,7 +1199,7 @@ ngx_http_parse_complex_uri(ngx_http_request_t *r, ngx_uint_t merge_slashes)
ch = *p++;
} else if (ch == '\0') {
- r->zero_in_uri = 1;
+ return NGX_HTTP_PARSE_INVALID_REQUEST;
}
state = quoted_state;
@@ -1304,8 +1301,7 @@ ngx_http_parse_unsafe_uri(ngx_http_request_t *r, ngx_str_t *uri,
}
if (ch == '\0') {
- *flags |= NGX_HTTP_ZERO_IN_URI;
- continue;
+ goto unsafe;
}
if (ngx_path_separator(ch) && len > 2) {
@@ -1449,34 +1445,19 @@ ngx_http_arg(ngx_http_request_t *r, u_char *name, size_t len, ngx_str_t *value)
void
ngx_http_split_args(ngx_http_request_t *r, ngx_str_t *uri, ngx_str_t *args)
{
- u_char ch, *p, *last;
-
- p = uri->data;
-
- last = p + uri->len;
-
- args->len = 0;
-
- while (p < last) {
-
- ch = *p++;
+ u_char *p, *last;
- if (ch == '?') {
- args->len = last - p;
- args->data = p;
+ last = uri->data + uri->len;
- uri->len = p - 1 - uri->data;
+ p = ngx_strlchr(uri->data, last, '?');
- if (ngx_strlchr(p, last, '\0') != NULL) {
- r->zero_in_uri = 1;
- }
+ if (p) {
+ uri->len = p - uri->data;
+ p++;
+ args->len = last - p;
+ args->data = p;
- return;
- }
-
- if (ch == '\0') {
- r->zero_in_uri = 1;
- continue;
- }
+ } else {
+ args->len = 0;
}
}