Mercurial > hg > nginx-vendor-1-0
diff src/http/ngx_http_upstream.c @ 364:a39aab45a53f NGINX_0_6_26
nginx 0.6.26
*) Bugfix: the "proxy_store" and "fastcgi_store" directives did not
check a response length.
*) Bugfix: a segmentation fault occurred in worker process, if big
value was used in a "expires" directive.
Thanks to Joaquin Cuenca Abela.
*) Bugfix: nginx incorrectly detected cache line size on Pentium 4.
Thanks to Gena Makhomed.
*) Bugfix: in proxied or FastCGI subrequests a client original method
was used instead of the GET method.
*) Bugfix: socket leak in HTTPS mode if deferred accept was used.
Thanks to Ben Maurer.
*) Bugfix: nginx issued the bogus error message "SSL_shutdown() failed
(SSL: )"; bug appeared in 0.6.23.
*) Bugfix: in HTTPS mode requests might fail with the "bad write retry"
error; bug appeared in 0.6.23.
author | Igor Sysoev <http://sysoev.ru> |
---|---|
date | Mon, 11 Feb 2008 00:00:00 +0300 |
parents | 9121a0a91f47 |
children | babd3d9efb62 |
line wrap: on
line diff
--- a/src/http/ngx_http_upstream.c +++ b/src/http/ngx_http_upstream.c @@ -1352,6 +1352,8 @@ ngx_http_upstream_process_header(ngx_eve r->headers_out.status = u->headers_in.status_n; r->headers_out.status_line = u->headers_in.status_line; + u->headers_in.content_length_n = r->headers_out.content_length_n; + if (r->headers_out.content_length_n != -1) { u->length = (size_t) r->headers_out.content_length_n; @@ -1955,6 +1957,7 @@ ngx_http_upstream_process_downstream(ngx static void ngx_http_upstream_process_body(ngx_event_t *ev) { + ngx_temp_file_t *tf; ngx_event_pipe_t *p; ngx_connection_t *c, *downstream; ngx_http_log_ctx_t *ctx; @@ -2049,18 +2052,22 @@ ngx_http_upstream_process_body(ngx_event if (u->store) { - if (p->upstream_eof && u->headers_in.status_n == NGX_HTTP_OK) { - + tf = u->pipe->temp_file; + + if (p->upstream_eof + && u->headers_in.status_n == NGX_HTTP_OK + && (u->headers_in.content_length_n == -1 + || (u->headers_in.content_length_n == tf->offset))) + { ngx_http_upstream_store(r, u); } else if ((p->upstream_error || (p->upstream_eof && u->headers_in.status_n != NGX_HTTP_OK)) - && u->pipe->temp_file->file.fd != NGX_INVALID_FILE) + && tf->file.fd != NGX_INVALID_FILE) { - if (ngx_delete_file(u->pipe->temp_file->file.name.data) - == NGX_FILE_ERROR) - { + if (ngx_delete_file(tf->file.name.data) == NGX_FILE_ERROR) { + ngx_log_error(NGX_LOG_CRIT, r->connection->log, ngx_errno, ngx_delete_file_n " \"%s\" failed", u->pipe->temp_file->file.name.data);