Mercurial > hg > nginx
comparison src/http/ngx_http_upstream.c @ 1992:ee49a83b6de2 stable-0.5
r1886 merge:
test response length in proxy/fastcgi_store
author | Igor Sysoev <igor@sysoev.ru> |
---|---|
date | Sun, 04 May 2008 10:04:21 +0000 |
parents | c7757ce0ae97 |
children | f3205008c55a |
comparison
equal
deleted
inserted
replaced
1991:7cef148d87a0 | 1992:ee49a83b6de2 |
---|---|
1233 } | 1233 } |
1234 | 1234 |
1235 r->headers_out.status = u->headers_in.status_n; | 1235 r->headers_out.status = u->headers_in.status_n; |
1236 r->headers_out.status_line = u->headers_in.status_line; | 1236 r->headers_out.status_line = u->headers_in.status_line; |
1237 | 1237 |
1238 u->headers_in.content_length_n = r->headers_out.content_length_n; | |
1239 | |
1238 if (r->headers_out.content_length_n != -1) { | 1240 if (r->headers_out.content_length_n != -1) { |
1239 u->length = (size_t) r->headers_out.content_length_n; | 1241 u->length = (size_t) r->headers_out.content_length_n; |
1240 | 1242 |
1241 } else { | 1243 } else { |
1242 u->length = NGX_MAX_SIZE_T_VALUE; | 1244 u->length = NGX_MAX_SIZE_T_VALUE; |
1836 | 1838 |
1837 | 1839 |
1838 static void | 1840 static void |
1839 ngx_http_upstream_process_body(ngx_event_t *ev) | 1841 ngx_http_upstream_process_body(ngx_event_t *ev) |
1840 { | 1842 { |
1843 ngx_temp_file_t *tf; | |
1841 ngx_event_pipe_t *p; | 1844 ngx_event_pipe_t *p; |
1842 ngx_connection_t *c, *downstream; | 1845 ngx_connection_t *c, *downstream; |
1843 ngx_http_log_ctx_t *ctx; | 1846 ngx_http_log_ctx_t *ctx; |
1844 ngx_http_request_t *r; | 1847 ngx_http_request_t *r; |
1845 ngx_http_upstream_t *u; | 1848 ngx_http_upstream_t *u; |
1930 | 1933 |
1931 if (u->peer.connection) { | 1934 if (u->peer.connection) { |
1932 | 1935 |
1933 if (u->store) { | 1936 if (u->store) { |
1934 | 1937 |
1935 if (p->upstream_eof && u->headers_in.status_n == NGX_HTTP_OK) { | 1938 tf = u->pipe->temp_file; |
1936 | 1939 |
1940 if (p->upstream_eof | |
1941 && u->headers_in.status_n == NGX_HTTP_OK | |
1942 && (u->headers_in.content_length_n == -1 | |
1943 || (u->headers_in.content_length_n == tf->offset))) | |
1944 { | |
1937 ngx_http_upstream_store(r, u); | 1945 ngx_http_upstream_store(r, u); |
1938 | 1946 |
1939 } else if ((p->upstream_error | 1947 } else if ((p->upstream_error |
1940 || (p->upstream_eof | 1948 || (p->upstream_eof |
1941 && u->headers_in.status_n != NGX_HTTP_OK)) | 1949 && u->headers_in.status_n != NGX_HTTP_OK)) |
1942 && u->pipe->temp_file->file.fd != NGX_INVALID_FILE) | 1950 && tf->file.fd != NGX_INVALID_FILE) |
1943 { | 1951 { |
1944 if (ngx_delete_file(u->pipe->temp_file->file.name.data) | 1952 if (ngx_delete_file(tf->file.name.data) == NGX_FILE_ERROR) { |
1945 == NGX_FILE_ERROR) | 1953 |
1946 { | |
1947 ngx_log_error(NGX_LOG_CRIT, r->connection->log, ngx_errno, | 1954 ngx_log_error(NGX_LOG_CRIT, r->connection->log, ngx_errno, |
1948 ngx_delete_file_n " \"%s\" failed", | 1955 ngx_delete_file_n " \"%s\" failed", |
1949 u->pipe->temp_file->file.name.data); | 1956 u->pipe->temp_file->file.name.data); |
1950 } | 1957 } |
1951 } | 1958 } |