Mercurial > hg > nginx
comparison src/http/ngx_http_upstream.c @ 4650:b38fea6f9a15
Fixed returned value handling from the cookie rewrite handler.
If the "proxy_cookie_domain" or "proxy_cookie_path" directive is used and there
are no matches in Set-Cookie header then ngx_http_proxy_rewrite_cookie() returns
NGX_DECLINED to indicate that the header was not rewritten. Returning this value
further from the upstream headers copy handler resulted in 500 error response.
See here for report:
http://mailman.nginx.org/pipermail/nginx/2012-May/033858.html
author | Valentin Bartenev <vbart@nginx.com> |
---|---|
date | Wed, 30 May 2012 12:30:03 +0000 |
parents | 67653855682e |
children | c48902a053d6 6fc86fe0b586 |
comparison
equal
deleted
inserted
replaced
4649:95d93f7e6fa2 | 4650:b38fea6f9a15 |
---|---|
3675 | 3675 |
3676 static ngx_int_t | 3676 static ngx_int_t |
3677 ngx_http_upstream_rewrite_set_cookie(ngx_http_request_t *r, ngx_table_elt_t *h, | 3677 ngx_http_upstream_rewrite_set_cookie(ngx_http_request_t *r, ngx_table_elt_t *h, |
3678 ngx_uint_t offset) | 3678 ngx_uint_t offset) |
3679 { | 3679 { |
3680 ngx_int_t rc; | |
3680 ngx_table_elt_t *ho; | 3681 ngx_table_elt_t *ho; |
3681 | 3682 |
3682 ho = ngx_list_push(&r->headers_out.headers); | 3683 ho = ngx_list_push(&r->headers_out.headers); |
3683 if (ho == NULL) { | 3684 if (ho == NULL) { |
3684 return NGX_ERROR; | 3685 return NGX_ERROR; |
3685 } | 3686 } |
3686 | 3687 |
3687 *ho = *h; | 3688 *ho = *h; |
3688 | 3689 |
3689 if (r->upstream->rewrite_cookie) { | 3690 if (r->upstream->rewrite_cookie) { |
3690 return r->upstream->rewrite_cookie(r, ho); | 3691 rc = r->upstream->rewrite_cookie(r, ho); |
3692 | |
3693 if (rc == NGX_DECLINED) { | |
3694 return NGX_OK; | |
3695 } | |
3696 | |
3697 #if (NGX_DEBUG) | |
3698 if (rc == NGX_OK) { | |
3699 ngx_log_debug1(NGX_LOG_DEBUG_HTTP, r->connection->log, 0, | |
3700 "rewritten cookie: \"%V\"", &ho->value); | |
3701 } | |
3702 #endif | |
3703 | |
3704 return rc; | |
3691 } | 3705 } |
3692 | 3706 |
3693 return NGX_OK; | 3707 return NGX_OK; |
3694 } | 3708 } |
3695 | 3709 |