Welcome to mirror list, hosted at ThFree Co, Russian Federation.

github.com/nginx/nginx.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorIgor Sysoev <igor@sysoev.ru>2004-09-05 23:54:02 +0400
committerIgor Sysoev <igor@sysoev.ru>2004-09-05 23:54:02 +0400
commit980a92472cc30271ad7e88eb2dcc43f00e984d4d (patch)
treeb8940cd9e6b8859c78e3c023c1373bae02371f2e /src/http/modules/ngx_http_userid_filter.c
parentb9e344175f4e971284aa14c8fe685936a4957d52 (diff)
nginx-0.0.10-2004-09-05-23:54:02 import
Diffstat (limited to 'src/http/modules/ngx_http_userid_filter.c')
-rw-r--r--src/http/modules/ngx_http_userid_filter.c28
1 files changed, 12 insertions, 16 deletions
diff --git a/src/http/modules/ngx_http_userid_filter.c b/src/http/modules/ngx_http_userid_filter.c
index ba0d5838e..842719e52 100644
--- a/src/http/modules/ngx_http_userid_filter.c
+++ b/src/http/modules/ngx_http_userid_filter.c
@@ -196,25 +196,22 @@ static ngx_int_t ngx_http_userid_get_uid(ngx_http_request_t *r,
ngx_http_userid_ctx_t *ctx,
ngx_http_userid_conf_t *conf)
{
- u_char *start, *last, *end;
- ngx_uint_t *cookies, i;
- ngx_str_t src, dst;
- ngx_table_elt_t *headers;
+ u_char *start, *last, *end;
+ ngx_uint_t i;
+ ngx_str_t src, dst;
+ ngx_table_elt_t **cookies;
- headers = r->headers_in.headers.elts;
cookies = r->headers_in.cookies.elts;
for (i = 0; i < r->headers_in.cookies.nelts; i++) {
- ngx_log_debug2(NGX_LOG_DEBUG_HTTP, r->connection->log, 0,
- "cookie: %d:\"%s\"",
- cookies[i],
- headers[cookies[i]].value.data);
+ ngx_log_debug1(NGX_LOG_DEBUG_HTTP, r->connection->log, 0,
+ "cookie: \"%s\"", cookies[i]->value.data);
- end = headers[cookies[i]].value.data + headers[cookies[i]].value.len;
+ end = cookies[i]->value.data + cookies[i]->value.len;
- for (start = headers[cookies[i]].value.data; start < end; /* void */) {
+ for (start = cookies[i]->value.data; start < end; /* void */) {
- if (conf->name.len >= headers[cookies[i]].value.len
+ if (conf->name.len >= cookies[i]->value.len
|| ngx_strncmp(start, conf->name.data, conf->name.len) != 0)
{
start += conf->name.len;
@@ -241,7 +238,7 @@ static ngx_int_t ngx_http_userid_get_uid(ngx_http_request_t *r,
if (last - start < 22) {
ngx_log_error(NGX_LOG_ERR, r->connection->log, 0,
"client sent too short userid cookie \"%s\"",
- headers[cookies[i]].value.data);
+ cookies[i]->value.data);
break;
}
@@ -258,7 +255,7 @@ static ngx_int_t ngx_http_userid_get_uid(ngx_http_request_t *r,
if (ngx_decode_base64(&src, &dst) == NGX_ERROR) {
ngx_log_error(NGX_LOG_ERR, r->connection->log, 0,
"client sent invalid userid cookie \"%s\"",
- headers[cookies[i]].value.data);
+ cookies[i]->value.data);
break;
}
@@ -384,8 +381,7 @@ static ngx_int_t ngx_http_userid_set_uid(ngx_http_request_t *r,
ngx_log_debug1(NGX_LOG_DEBUG_HTTP, r->connection->log, 0,
"uid cookie: \"%s\"", cookie);
- set_cookie = ngx_http_add_header(&r->headers_out, ngx_http_headers_out);
- if (set_cookie == NULL) {
+ if (!(set_cookie = ngx_push_list(&r->headers_out.headers))) {
return NGX_ERROR;
}