aboutsummaryrefslogtreecommitdiff
path: root/src/http/ngx_http_variables.c
diff options
context:
space:
mode:
authorIgor Sysoev <igor@sysoev.ru>2008-12-22 12:02:05 +0000
committerIgor Sysoev <igor@sysoev.ru>2008-12-22 12:02:05 +0000
commit84d17bba650167380268ee0f86c6789a04a02426 (patch)
tree13b6bf1466ef1ac3112c2a4d028d34c31385eaac /src/http/ngx_http_variables.c
parented9b6d8962c6b7cf0546d0b2d69f34c879395757 (diff)
downloadnginx-84d17bba650167380268ee0f86c6789a04a02426.tar.gz
nginx-84d17bba650167380268ee0f86c6789a04a02426.zip
ngx_http_arg()
Diffstat (limited to 'src/http/ngx_http_variables.c')
-rw-r--r--src/http/ngx_http_variables.c52
1 files changed, 12 insertions, 40 deletions
diff --git a/src/http/ngx_http_variables.c b/src/http/ngx_http_variables.c
index 998c4ce35..52584c3d3 100644
--- a/src/http/ngx_http_variables.c
+++ b/src/http/ngx_http_variables.c
@@ -772,51 +772,23 @@ ngx_http_variable_argument(ngx_http_request_t *r, ngx_http_variable_value_t *v,
{
ngx_str_t *name = (ngx_str_t *) data;
- u_char *p, *arg;
- size_t len;
-
- if (r->args.len == 0) {
- v->not_found = 1;
- return NGX_OK;
- }
+ u_char *arg;
+ size_t len;
+ ngx_str_t value;
- len = name->len - 1 - (sizeof("arg_") - 1);
+ len = name->len - (sizeof("arg_") - 1);
arg = name->data + sizeof("arg_") - 1;
- 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 *) arg, len);
-
- if (p == NULL) {
- v->not_found = 1;
- return NGX_OK;
- }
-
- if ((p == r->args.data || *(p - 1) == '&') && *(p + len + 1) == '=') {
-
- v->data = p + len + 2;
-
- p = (u_char *) ngx_strchr(p, '&');
-
- if (p == NULL) {
- p = r->args.data + r->args.len;
- }
-
- v->len = p - v->data;
- v->valid = 1;
- v->no_cacheable = 0;
- v->not_found = 0;
-
- return NGX_OK;
- }
+ if (ngx_http_arg(r, arg, len, &value) != NGX_OK) {
+ v->not_found = 1;
+ return NGX_OK;
}
- v->not_found = 1;
+ v->data = value.data;
+ v->len = value.len;
+ v->valid = 1;
+ v->no_cacheable = 0;
+ v->not_found = 0;
return NGX_OK;
}