comparison 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
comparison
equal deleted inserted replaced
363:6999caedb665 364:a39aab45a53f
1350 } 1350 }
1351 1351
1352 r->headers_out.status = u->headers_in.status_n; 1352 r->headers_out.status = u->headers_in.status_n;
1353 r->headers_out.status_line = u->headers_in.status_line; 1353 r->headers_out.status_line = u->headers_in.status_line;
1354 1354
1355 u->headers_in.content_length_n = r->headers_out.content_length_n;
1356
1355 if (r->headers_out.content_length_n != -1) { 1357 if (r->headers_out.content_length_n != -1) {
1356 u->length = (size_t) r->headers_out.content_length_n; 1358 u->length = (size_t) r->headers_out.content_length_n;
1357 1359
1358 } else { 1360 } else {
1359 u->length = NGX_MAX_SIZE_T_VALUE; 1361 u->length = NGX_MAX_SIZE_T_VALUE;
1953 1955
1954 1956
1955 static void 1957 static void
1956 ngx_http_upstream_process_body(ngx_event_t *ev) 1958 ngx_http_upstream_process_body(ngx_event_t *ev)
1957 { 1959 {
1960 ngx_temp_file_t *tf;
1958 ngx_event_pipe_t *p; 1961 ngx_event_pipe_t *p;
1959 ngx_connection_t *c, *downstream; 1962 ngx_connection_t *c, *downstream;
1960 ngx_http_log_ctx_t *ctx; 1963 ngx_http_log_ctx_t *ctx;
1961 ngx_http_request_t *r; 1964 ngx_http_request_t *r;
1962 ngx_http_upstream_t *u; 1965 ngx_http_upstream_t *u;
2047 2050
2048 if (u->peer.connection) { 2051 if (u->peer.connection) {
2049 2052
2050 if (u->store) { 2053 if (u->store) {
2051 2054
2052 if (p->upstream_eof && u->headers_in.status_n == NGX_HTTP_OK) { 2055 tf = u->pipe->temp_file;
2053 2056
2057 if (p->upstream_eof
2058 && u->headers_in.status_n == NGX_HTTP_OK
2059 && (u->headers_in.content_length_n == -1
2060 || (u->headers_in.content_length_n == tf->offset)))
2061 {
2054 ngx_http_upstream_store(r, u); 2062 ngx_http_upstream_store(r, u);
2055 2063
2056 } else if ((p->upstream_error 2064 } else if ((p->upstream_error
2057 || (p->upstream_eof 2065 || (p->upstream_eof
2058 && u->headers_in.status_n != NGX_HTTP_OK)) 2066 && u->headers_in.status_n != NGX_HTTP_OK))
2059 && u->pipe->temp_file->file.fd != NGX_INVALID_FILE) 2067 && tf->file.fd != NGX_INVALID_FILE)
2060 { 2068 {
2061 if (ngx_delete_file(u->pipe->temp_file->file.name.data) 2069 if (ngx_delete_file(tf->file.name.data) == NGX_FILE_ERROR) {
2062 == NGX_FILE_ERROR) 2070
2063 {
2064 ngx_log_error(NGX_LOG_CRIT, r->connection->log, ngx_errno, 2071 ngx_log_error(NGX_LOG_CRIT, r->connection->log, ngx_errno,
2065 ngx_delete_file_n " \"%s\" failed", 2072 ngx_delete_file_n " \"%s\" failed",
2066 u->pipe->temp_file->file.name.data); 2073 u->pipe->temp_file->file.name.data);
2067 } 2074 }
2068 } 2075 }