Mercurial > hg > nginx-vendor-current
comparison src/http/ngx_http_upstream.c @ 662:e5fa0a4a7d27 NGINX_1_1_15
nginx 1.1.15
*) Feature: the "disable_symlinks" directive.
*) Feature: the "proxy_cookie_domain" and "proxy_cookie_path"
directives.
*) Bugfix: nginx might log incorrect error "upstream prematurely closed
connection" instead of correct "upstream sent too big header" one.
Thanks to Feibo Li.
*) Bugfix: nginx could not be built with the ngx_http_perl_module if the
--with-openssl option was used.
*) Bugfix: internal redirects to named locations were not limited.
*) Bugfix: calling $r->flush() multiple times might cause errors in the
ngx_http_gzip_filter_module.
*) Bugfix: temporary files might be not removed if the "proxy_store"
directive were used with SSI includes.
*) Bugfix: in some cases non-cacheable variables (such as the $args
variable) returned old empty cached value.
*) Bugfix: a segmentation fault might occur in a worker process if too
many SSI subrequests were issued simultaneously; the bug had appeared
in 0.7.25.
author | Igor Sysoev <http://sysoev.ru> |
---|---|
date | Wed, 15 Feb 2012 00:00:00 +0400 |
parents | d0f7a625f27c |
children | f5b859b2f097 |
comparison
equal
deleted
inserted
replaced
661:b49c1751031c | 662:e5fa0a4a7d27 |
---|---|
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 |
1589 | 1591 |
1590 rc = u->process_header(r); | 1592 rc = u->process_header(r); |
1591 | 1593 |
1592 if (rc == NGX_AGAIN) { | 1594 if (rc == NGX_AGAIN) { |
1593 | 1595 |
1594 if (u->buffer.pos == u->buffer.end) { | 1596 if (u->buffer.last == u->buffer.end) { |
1595 ngx_log_error(NGX_LOG_ERR, c->log, 0, | 1597 ngx_log_error(NGX_LOG_ERR, c->log, 0, |
1596 "upstream sent too big header"); | 1598 "upstream sent too big header"); |
1597 | 1599 |
1598 ngx_http_upstream_next(r, u, | 1600 ngx_http_upstream_next(r, u, |
1599 NGX_HTTP_UPSTREAM_FT_INVALID_HEADER); | 1601 NGX_HTTP_UPSTREAM_FT_INVALID_HEADER); |
2647 | 2649 |
2648 | 2650 |
2649 static void | 2651 static void |
2650 ngx_http_upstream_process_request(ngx_http_request_t *r) | 2652 ngx_http_upstream_process_request(ngx_http_request_t *r) |
2651 { | 2653 { |
2652 ngx_uint_t del; | |
2653 ngx_temp_file_t *tf; | 2654 ngx_temp_file_t *tf; |
2654 ngx_event_pipe_t *p; | 2655 ngx_event_pipe_t *p; |
2655 ngx_http_upstream_t *u; | 2656 ngx_http_upstream_t *u; |
2656 | 2657 |
2657 u = r->upstream; | 2658 u = r->upstream; |
2659 | 2660 |
2660 if (u->peer.connection) { | 2661 if (u->peer.connection) { |
2661 | 2662 |
2662 if (u->store) { | 2663 if (u->store) { |
2663 | 2664 |
2664 del = p->upstream_error; | |
2665 | |
2666 tf = u->pipe->temp_file; | |
2667 | |
2668 if (p->upstream_eof || p->upstream_done) { | 2665 if (p->upstream_eof || p->upstream_done) { |
2666 | |
2667 tf = u->pipe->temp_file; | |
2669 | 2668 |
2670 if (u->headers_in.status_n == NGX_HTTP_OK | 2669 if (u->headers_in.status_n == NGX_HTTP_OK |
2671 && (u->headers_in.content_length_n == -1 | 2670 && (u->headers_in.content_length_n == -1 |
2672 || (u->headers_in.content_length_n == tf->offset))) | 2671 || (u->headers_in.content_length_n == tf->offset))) |
2673 { | 2672 { |
2674 ngx_http_upstream_store(r, u); | 2673 ngx_http_upstream_store(r, u); |
2675 | 2674 u->store = 0; |
2676 } else { | |
2677 del = 1; | |
2678 } | |
2679 } | |
2680 | |
2681 if (del && tf->file.fd != NGX_INVALID_FILE) { | |
2682 | |
2683 if (ngx_delete_file(tf->file.name.data) == NGX_FILE_ERROR) { | |
2684 | |
2685 ngx_log_error(NGX_LOG_CRIT, r->connection->log, ngx_errno, | |
2686 ngx_delete_file_n " \"%s\" failed", | |
2687 u->pipe->temp_file->file.name.data); | |
2688 } | 2675 } |
2689 } | 2676 } |
2690 } | 2677 } |
2691 | 2678 |
2692 #if (NGX_HTTP_CACHE) | 2679 #if (NGX_HTTP_CACHE) |
3045 ngx_log_debug1(NGX_LOG_DEBUG_HTTP, r->connection->log, 0, | 3032 ngx_log_debug1(NGX_LOG_DEBUG_HTTP, r->connection->log, 0, |
3046 "http upstream temp fd: %d", | 3033 "http upstream temp fd: %d", |
3047 u->pipe->temp_file->file.fd); | 3034 u->pipe->temp_file->file.fd); |
3048 } | 3035 } |
3049 | 3036 |
3037 if (u->store && u->pipe && u->pipe->temp_file | |
3038 && u->pipe->temp_file->file.fd != NGX_INVALID_FILE) | |
3039 { | |
3040 if (ngx_delete_file(u->pipe->temp_file->file.name.data) | |
3041 == NGX_FILE_ERROR) | |
3042 { | |
3043 ngx_log_error(NGX_LOG_CRIT, r->connection->log, ngx_errno, | |
3044 ngx_delete_file_n " \"%s\" failed", | |
3045 u->pipe->temp_file->file.name.data); | |
3046 } | |
3047 } | |
3048 | |
3050 #if (NGX_HTTP_CACHE) | 3049 #if (NGX_HTTP_CACHE) |
3051 | 3050 |
3052 if (r->cache) { | 3051 if (r->cache) { |
3053 | 3052 |
3054 if (u->cacheable) { | 3053 if (u->cacheable) { |
3665 | 3664 |
3666 return rc; | 3665 return rc; |
3667 } | 3666 } |
3668 | 3667 |
3669 r->headers_out.refresh = ho; | 3668 r->headers_out.refresh = ho; |
3669 | |
3670 return NGX_OK; | |
3671 } | |
3672 | |
3673 | |
3674 static ngx_int_t | |
3675 ngx_http_upstream_rewrite_set_cookie(ngx_http_request_t *r, ngx_table_elt_t *h, | |
3676 ngx_uint_t offset) | |
3677 { | |
3678 ngx_table_elt_t *ho; | |
3679 | |
3680 ho = ngx_list_push(&r->headers_out.headers); | |
3681 if (ho == NULL) { | |
3682 return NGX_ERROR; | |
3683 } | |
3684 | |
3685 *ho = *h; | |
3686 | |
3687 if (r->upstream->rewrite_cookie) { | |
3688 return r->upstream->rewrite_cookie(r, ho); | |
3689 } | |
3670 | 3690 |
3671 return NGX_OK; | 3691 return NGX_OK; |
3672 } | 3692 } |
3673 | 3693 |
3674 | 3694 |
4246 s.len = value[i].len - 13; | 4266 s.len = value[i].len - 13; |
4247 s.data = &value[i].data[13]; | 4267 s.data = &value[i].data[13]; |
4248 | 4268 |
4249 fail_timeout = ngx_parse_time(&s, 1); | 4269 fail_timeout = ngx_parse_time(&s, 1); |
4250 | 4270 |
4251 if (fail_timeout == NGX_ERROR) { | 4271 if (fail_timeout == (time_t) NGX_ERROR) { |
4252 goto invalid; | 4272 goto invalid; |
4253 } | 4273 } |
4254 | 4274 |
4255 continue; | 4275 continue; |
4256 } | 4276 } |