Mercurial > hg > nginx-vendor-current
diff src/http/ngx_http_parse.c @ 432:fd759445d8a8 NGINX_0_7_28
nginx 0.7.28
*) Change: in memory allocation in the ngx_http_gzip_filter_module.
*) Change: the default "gzip_buffers" directive values have been
changed to 32 4k or 16 8k from 4 4k/8k.
author | Igor Sysoev <http://sysoev.ru> |
---|---|
date | Mon, 22 Dec 2008 00:00:00 +0300 |
parents | b246022ef454 |
children | c8cfb6c462ef |
line wrap: on
line diff
--- a/src/http/ngx_http_parse.c +++ b/src/http/ngx_http_parse.c @@ -1481,3 +1481,45 @@ ngx_http_parse_multi_header_lines(ngx_ar return NGX_DECLINED; } + + +ngx_int_t +ngx_http_arg(ngx_http_request_t *r, u_char *name, size_t len, ngx_str_t *value) +{ + u_char *p; + + if (r->args.len == 0) { + return NGX_DECLINED; + } + + for (p = r->args.data; *p && *p != ' '; p++) { + + /* + * although r->args.data is not null-terminated by itself, + * however, there is null in the end of request line + */ + + p = ngx_strcasestrn(p, (char *) name, len - 1); + + if (p == NULL) { + return NGX_DECLINED; + } + + if ((p == r->args.data || *(p - 1) == '&') && *(p + len) == '=') { + + value->data = p + len + 1; + + p = (u_char *) ngx_strchr(p, '&'); + + if (p == NULL) { + p = r->args.data + r->args.len; + } + + value->len = p - value->data; + + return NGX_OK; + } + } + + return NGX_DECLINED; +}