diff options
author | Vladimir Homutov <vl@nginx.com> | 2014-04-29 12:28:41 +0400 |
---|---|---|
committer | Vladimir Homutov <vl@nginx.com> | 2014-04-29 12:28:41 +0400 |
commit | ed6780aaf12e99cce0fa3b27fff229b87aefec16 (patch) | |
tree | 9b9cef3fe01e83abdb0c4dee788d4b9330ba124b /src/http/ngx_http_parse.c | |
parent | b53306815ecb226c6ae0dd9729a7a0af0043b4d4 (diff) | |
download | nginx-ed6780aaf12e99cce0fa3b27fff229b87aefec16.tar.gz nginx-ed6780aaf12e99cce0fa3b27fff229b87aefec16.zip |
Upstream: added the "$upstream_cookie_<name>" variables.
Diffstat (limited to 'src/http/ngx_http_parse.c')
-rw-r--r-- | src/http/ngx_http_parse.c | 51 |
1 files changed, 51 insertions, 0 deletions
diff --git a/src/http/ngx_http_parse.c b/src/http/ngx_http_parse.c index 02b4a0fd1..f28786946 100644 --- a/src/http/ngx_http_parse.c +++ b/src/http/ngx_http_parse.c @@ -1985,6 +1985,57 @@ ngx_http_parse_multi_header_lines(ngx_array_t *headers, ngx_str_t *name, ngx_int_t +ngx_http_parse_set_cookie_lines(ngx_array_t *headers, ngx_str_t *name, + ngx_str_t *value) +{ + ngx_uint_t i; + u_char *start, *last, *end; + ngx_table_elt_t **h; + + h = headers->elts; + + for (i = 0; i < headers->nelts; i++) { + + ngx_log_debug2(NGX_LOG_DEBUG_HTTP, headers->pool->log, 0, + "parse header: \"%V: %V\"", &h[i]->key, &h[i]->value); + + if (name->len >= h[i]->value.len) { + continue; + } + + start = h[i]->value.data; + end = h[i]->value.data + h[i]->value.len; + + if (ngx_strncasecmp(start, name->data, name->len) != 0) { + continue; + } + + for (start += name->len; start < end && *start == ' '; start++) { + /* void */ + } + + if (start == end || *start++ != '=') { + /* the invalid header value */ + continue; + } + + while (start < end && *start == ' ') { start++; } + + for (last = start; last < end && *last != ';'; last++) { + /* void */ + } + + value->len = last - start; + value->data = start; + + return i; + } + + 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, *last; |