comparison src/http/ngx_http_upstream.c @ 4464:7bf3b68239a3

Upstream: added callback hook for the "Set-Cookie" header. No functional changes.
author Valentin Bartenev <vbart@nginx.com>
date Mon, 13 Feb 2012 11:01:58 +0000
parents 6299d1c4dbb4
children 24c0dca04eb9
comparison
equal deleted inserted replaced
4463:a068ec122f17 4464:7bf3b68239a3
108 ngx_table_elt_t *h, ngx_uint_t offset); 108 ngx_table_elt_t *h, ngx_uint_t offset);
109 static ngx_int_t ngx_http_upstream_rewrite_location(ngx_http_request_t *r, 109 static ngx_int_t ngx_http_upstream_rewrite_location(ngx_http_request_t *r,
110 ngx_table_elt_t *h, ngx_uint_t offset); 110 ngx_table_elt_t *h, ngx_uint_t offset);
111 static ngx_int_t ngx_http_upstream_rewrite_refresh(ngx_http_request_t *r, 111 static ngx_int_t ngx_http_upstream_rewrite_refresh(ngx_http_request_t *r,
112 ngx_table_elt_t *h, ngx_uint_t offset); 112 ngx_table_elt_t *h, ngx_uint_t offset);
113 static ngx_int_t ngx_http_upstream_rewrite_set_cookie(ngx_http_request_t *r,
114 ngx_table_elt_t *h, ngx_uint_t offset);
113 static ngx_int_t ngx_http_upstream_copy_allow_ranges(ngx_http_request_t *r, 115 static ngx_int_t ngx_http_upstream_copy_allow_ranges(ngx_http_request_t *r,
114 ngx_table_elt_t *h, ngx_uint_t offset); 116 ngx_table_elt_t *h, ngx_uint_t offset);
115 117
116 #if (NGX_HTTP_GZIP) 118 #if (NGX_HTTP_GZIP)
117 static ngx_int_t ngx_http_upstream_copy_content_encoding(ngx_http_request_t *r, 119 static ngx_int_t ngx_http_upstream_copy_content_encoding(ngx_http_request_t *r,
196 ngx_http_upstream_ignore_header_line, 0, 198 ngx_http_upstream_ignore_header_line, 0,
197 ngx_http_upstream_rewrite_refresh, 0, 0 }, 199 ngx_http_upstream_rewrite_refresh, 0, 0 },
198 200
199 { ngx_string("Set-Cookie"), 201 { ngx_string("Set-Cookie"),
200 ngx_http_upstream_process_set_cookie, 0, 202 ngx_http_upstream_process_set_cookie, 0,
201 ngx_http_upstream_copy_header_line, 0, 1 }, 203 ngx_http_upstream_rewrite_set_cookie, 0, 1 },
202 204
203 { ngx_string("Content-Disposition"), 205 { ngx_string("Content-Disposition"),
204 ngx_http_upstream_ignore_header_line, 0, 206 ngx_http_upstream_ignore_header_line, 0,
205 ngx_http_upstream_copy_header_line, 0, 1 }, 207 ngx_http_upstream_copy_header_line, 0, 1 },
206 208
3671 return NGX_OK; 3673 return NGX_OK;
3672 } 3674 }
3673 3675
3674 3676
3675 static ngx_int_t 3677 static ngx_int_t
3678 ngx_http_upstream_rewrite_set_cookie(ngx_http_request_t *r, ngx_table_elt_t *h,
3679 ngx_uint_t offset)
3680 {
3681 ngx_table_elt_t *ho;
3682
3683 ho = ngx_list_push(&r->headers_out.headers);
3684 if (ho == NULL) {
3685 return NGX_ERROR;
3686 }
3687
3688 *ho = *h;
3689
3690 if (r->upstream->rewrite_cookie) {
3691 return r->upstream->rewrite_cookie(r, ho);
3692 }
3693
3694 return NGX_OK;
3695 }
3696
3697
3698 static ngx_int_t
3676 ngx_http_upstream_copy_allow_ranges(ngx_http_request_t *r, 3699 ngx_http_upstream_copy_allow_ranges(ngx_http_request_t *r,
3677 ngx_table_elt_t *h, ngx_uint_t offset) 3700 ngx_table_elt_t *h, ngx_uint_t offset)
3678 { 3701 {
3679 ngx_table_elt_t *ho; 3702 ngx_table_elt_t *ho;
3680 3703