comparison src/http/ngx_http_parse.c @ 5677:3a48775f1535

Upstream: added the "$upstream_cookie_<name>" variables.
author Vladimir Homutov <vl@nginx.com>
date Tue, 29 Apr 2014 12:28:41 +0400
parents bd91f286ee0a
children c5ec6944de98
comparison
equal deleted inserted replaced
5676:fbfdf8017748 5677:3a48775f1535
1983 return NGX_DECLINED; 1983 return NGX_DECLINED;
1984 } 1984 }
1985 1985
1986 1986
1987 ngx_int_t 1987 ngx_int_t
1988 ngx_http_parse_set_cookie_lines(ngx_array_t *headers, ngx_str_t *name,
1989 ngx_str_t *value)
1990 {
1991 ngx_uint_t i;
1992 u_char *start, *last, *end;
1993 ngx_table_elt_t **h;
1994
1995 h = headers->elts;
1996
1997 for (i = 0; i < headers->nelts; i++) {
1998
1999 ngx_log_debug2(NGX_LOG_DEBUG_HTTP, headers->pool->log, 0,
2000 "parse header: \"%V: %V\"", &h[i]->key, &h[i]->value);
2001
2002 if (name->len >= h[i]->value.len) {
2003 continue;
2004 }
2005
2006 start = h[i]->value.data;
2007 end = h[i]->value.data + h[i]->value.len;
2008
2009 if (ngx_strncasecmp(start, name->data, name->len) != 0) {
2010 continue;
2011 }
2012
2013 for (start += name->len; start < end && *start == ' '; start++) {
2014 /* void */
2015 }
2016
2017 if (start == end || *start++ != '=') {
2018 /* the invalid header value */
2019 continue;
2020 }
2021
2022 while (start < end && *start == ' ') { start++; }
2023
2024 for (last = start; last < end && *last != ';'; last++) {
2025 /* void */
2026 }
2027
2028 value->len = last - start;
2029 value->data = start;
2030
2031 return i;
2032 }
2033
2034 return NGX_DECLINED;
2035 }
2036
2037
2038 ngx_int_t
1988 ngx_http_arg(ngx_http_request_t *r, u_char *name, size_t len, ngx_str_t *value) 2039 ngx_http_arg(ngx_http_request_t *r, u_char *name, size_t len, ngx_str_t *value)
1989 { 2040 {
1990 u_char *p, *last; 2041 u_char *p, *last;
1991 2042
1992 if (r->args.len == 0) { 2043 if (r->args.len == 0) {