comparison src/http/ngx_http_upstream.c @ 646:09a689c5e494 NGINX_1_0_13

nginx 1.0.13 *) Feature: the "return" and "error_page" directives can now be used to return 307 redirections. *) Bugfix: a segmentation fault might occur in a worker process if the "resolver" directive was used and there was no "error_log" directive specified at global level. Thanks to Roman Arutyunyan. *) Bugfix: memory leaks. Thanks to Lanshun Zhou. *) Bugfix: nginx might log incorrect error "upstream prematurely closed connection" instead of correct "upstream sent too big header" one. Thanks to Feibo Li. *) Bugfix: on ZFS filesystem disk cache size might be calculated incorrectly; the bug had appeared in 1.0.1. *) Bugfix: the number of internal redirects to named locations was not limited. *) Bugfix: temporary files might be not removed if the "proxy_store" directive was used with SSI includes. *) Bugfix: in some cases non-cacheable variables (such as the $args variable) returned old empty cached value. *) Bugfix: the "proxy_redirect" directives might be inherited incorrectly. *) Bugfix: nginx could not be built with the ngx_http_perl_module if the --with-openssl option was used. *) Bugfix: nginx could not be built by the icc 12.1 compiler.
author Igor Sysoev <http://sysoev.ru>
date Mon, 05 Mar 2012 00:00:00 +0400
parents ad25218fd14b
children
comparison
equal deleted inserted replaced
645:60344e6faa47 646:09a689c5e494
1559 1559
1560 rc = u->process_header(r); 1560 rc = u->process_header(r);
1561 1561
1562 if (rc == NGX_AGAIN) { 1562 if (rc == NGX_AGAIN) {
1563 1563
1564 if (u->buffer.pos == u->buffer.end) { 1564 if (u->buffer.last == u->buffer.end) {
1565 ngx_log_error(NGX_LOG_ERR, c->log, 0, 1565 ngx_log_error(NGX_LOG_ERR, c->log, 0,
1566 "upstream sent too big header"); 1566 "upstream sent too big header");
1567 1567
1568 ngx_http_upstream_next(r, u, 1568 ngx_http_upstream_next(r, u,
1569 NGX_HTTP_UPSTREAM_FT_INVALID_HEADER); 1569 NGX_HTTP_UPSTREAM_FT_INVALID_HEADER);
2261 p->buf_to_file->last = u->buffer.pos; 2261 p->buf_to_file->last = u->buffer.pos;
2262 p->buf_to_file->temporary = 1; 2262 p->buf_to_file->temporary = 1;
2263 } 2263 }
2264 2264
2265 if (ngx_event_flags & NGX_USE_AIO_EVENT) { 2265 if (ngx_event_flags & NGX_USE_AIO_EVENT) {
2266 /* the posted aio operation may currupt a shadow buffer */ 2266 /* the posted aio operation may corrupt a shadow buffer */
2267 p->single_buf = 1; 2267 p->single_buf = 1;
2268 } 2268 }
2269 2269
2270 /* TODO: p->free_bufs = 0 if use ngx_create_chain_of_bufs() */ 2270 /* TODO: p->free_bufs = 0 if use ngx_create_chain_of_bufs() */
2271 p->free_bufs = 1; 2271 p->free_bufs = 1;
2614 2614
2615 2615
2616 static void 2616 static void
2617 ngx_http_upstream_process_request(ngx_http_request_t *r) 2617 ngx_http_upstream_process_request(ngx_http_request_t *r)
2618 { 2618 {
2619 ngx_uint_t del;
2620 ngx_temp_file_t *tf; 2619 ngx_temp_file_t *tf;
2621 ngx_event_pipe_t *p; 2620 ngx_event_pipe_t *p;
2622 ngx_http_upstream_t *u; 2621 ngx_http_upstream_t *u;
2623 2622
2624 u = r->upstream; 2623 u = r->upstream;
2626 2625
2627 if (u->peer.connection) { 2626 if (u->peer.connection) {
2628 2627
2629 if (u->store) { 2628 if (u->store) {
2630 2629
2631 del = p->upstream_error;
2632
2633 tf = u->pipe->temp_file;
2634
2635 if (p->upstream_eof || p->upstream_done) { 2630 if (p->upstream_eof || p->upstream_done) {
2631
2632 tf = u->pipe->temp_file;
2636 2633
2637 if (u->headers_in.status_n == NGX_HTTP_OK 2634 if (u->headers_in.status_n == NGX_HTTP_OK
2638 && (u->headers_in.content_length_n == -1 2635 && (u->headers_in.content_length_n == -1
2639 || (u->headers_in.content_length_n == tf->offset))) 2636 || (u->headers_in.content_length_n == tf->offset)))
2640 { 2637 {
2641 ngx_http_upstream_store(r, u); 2638 ngx_http_upstream_store(r, u);
2642 2639 u->store = 0;
2643 } else {
2644 del = 1;
2645 }
2646 }
2647
2648 if (del && tf->file.fd != NGX_INVALID_FILE) {
2649
2650 if (ngx_delete_file(tf->file.name.data) == NGX_FILE_ERROR) {
2651
2652 ngx_log_error(NGX_LOG_CRIT, r->connection->log, ngx_errno,
2653 ngx_delete_file_n " \"%s\" failed",
2654 u->pipe->temp_file->file.name.data);
2655 } 2640 }
2656 } 2641 }
2657 } 2642 }
2658 2643
2659 #if (NGX_HTTP_CACHE) 2644 #if (NGX_HTTP_CACHE)
2990 2975
2991 if (u->pipe && u->pipe->temp_file) { 2976 if (u->pipe && u->pipe->temp_file) {
2992 ngx_log_debug1(NGX_LOG_DEBUG_HTTP, r->connection->log, 0, 2977 ngx_log_debug1(NGX_LOG_DEBUG_HTTP, r->connection->log, 0,
2993 "http upstream temp fd: %d", 2978 "http upstream temp fd: %d",
2994 u->pipe->temp_file->file.fd); 2979 u->pipe->temp_file->file.fd);
2980 }
2981
2982 if (u->store && u->pipe && u->pipe->temp_file
2983 && u->pipe->temp_file->file.fd != NGX_INVALID_FILE)
2984 {
2985 if (ngx_delete_file(u->pipe->temp_file->file.name.data)
2986 == NGX_FILE_ERROR)
2987 {
2988 ngx_log_error(NGX_LOG_CRIT, r->connection->log, ngx_errno,
2989 ngx_delete_file_n " \"%s\" failed",
2990 u->pipe->temp_file->file.name.data);
2991 }
2995 } 2992 }
2996 2993
2997 #if (NGX_HTTP_CACHE) 2994 #if (NGX_HTTP_CACHE)
2998 2995
2999 if (r->cache) { 2996 if (r->cache) {