aboutsummaryrefslogtreecommitdiff
path: root/src/http/ngx_http_parse.c
diff options
context:
space:
mode:
authorIgor Sysoev <igor@sysoev.ru>2009-04-04 17:51:38 +0000
committerIgor Sysoev <igor@sysoev.ru>2009-04-04 17:51:38 +0000
commit1dcaa97ccc0461df87a7c2956ce9f6b4fb1d0467 (patch)
tree81e97602dea9f55059075ed6f49b6b05fce75d38 /src/http/ngx_http_parse.c
parent21a3c66a877e3bdf153f86110e253ab4b3717bf5 (diff)
downloadnginx-1dcaa97ccc0461df87a7c2956ce9f6b4fb1d0467.tar.gz
nginx-1dcaa97ccc0461df87a7c2956ce9f6b4fb1d0467.zip
refactor ngx_http_arg() using ngx_strcasestrn(),
back out zero termination introduced in r2138
Diffstat (limited to 'src/http/ngx_http_parse.c')
-rw-r--r--src/http/ngx_http_parse.c16
1 files changed, 8 insertions, 8 deletions
diff --git a/src/http/ngx_http_parse.c b/src/http/ngx_http_parse.c
index 49f536a85..11e62e6ac 100644
--- a/src/http/ngx_http_parse.c
+++ b/src/http/ngx_http_parse.c
@@ -1486,20 +1486,20 @@ ngx_http_parse_multi_header_lines(ngx_array_t *headers, ngx_str_t *name,
ngx_int_t
ngx_http_arg(ngx_http_request_t *r, u_char *name, size_t len, ngx_str_t *value)
{
- u_char *p;
+ u_char *p, *last;
if (r->args.len == 0) {
return NGX_DECLINED;
}
- for (p = r->args.data; *p && *p != ' '; p++) {
+ p = r->args.data;
+ last = p + r->args.len;
- /*
- * although r->args.data is not null-terminated by itself,
- * however, there is null in the end of request line
- */
+ for ( /* void */ ; p < last; p++) {
+
+ /* we need '=' after name, so drop one char from last */
- p = ngx_strcasestrn(p, (char *) name, len - 1);
+ p = ngx_strlcasestrn(p, last - 1, name, len - 1);
if (p == NULL) {
return NGX_DECLINED;
@@ -1509,7 +1509,7 @@ ngx_http_arg(ngx_http_request_t *r, u_char *name, size_t len, ngx_str_t *value)
value->data = p + len + 1;
- p = (u_char *) ngx_strchr(p, '&');
+ p = ngx_strlchr(p, last, '&');
if (p == NULL) {
p = r->args.data + r->args.len;