Klaus Demo nginx / be0a61e
test response length in proxy/fastcgi_store Igor Sysoev 14 years ago
2 changed file(s) with 15 addition(s) and 6 deletion(s). Raw diff Collapse all Expand all
13511351 r->headers_out.status = u->headers_in.status_n;
13521352 r->headers_out.status_line = u->headers_in.status_line;
13531353
1354 u->headers_in.content_length_n = r->headers_out.content_length_n;
1355
13541356 if (r->headers_out.content_length_n != -1) {
13551357 u->length = (size_t) r->headers_out.content_length_n;
13561358
19541956 static void
19551957 ngx_http_upstream_process_body(ngx_event_t *ev)
19561958 {
1959 ngx_temp_file_t *tf;
19571960 ngx_event_pipe_t *p;
19581961 ngx_connection_t *c, *downstream;
19591962 ngx_http_log_ctx_t *ctx;
20482051
20492052 if (u->store) {
20502053
2051 if (p->upstream_eof && u->headers_in.status_n == NGX_HTTP_OK) {
2052
2054 tf = u->pipe->temp_file;
2055
2056 if (p->upstream_eof
2057 && u->headers_in.status_n == NGX_HTTP_OK
2058 && (u->headers_in.content_length_n == -1
2059 || (u->headers_in.content_length_n == tf->offset)))
2060 {
20532061 ngx_http_upstream_store(r, u);
20542062
20552063 } else if ((p->upstream_error
20562064 || (p->upstream_eof
20572065 && u->headers_in.status_n != NGX_HTTP_OK))
2058 && u->pipe->temp_file->file.fd != NGX_INVALID_FILE)
2066 && tf->file.fd != NGX_INVALID_FILE)
20592067 {
2060 if (ngx_delete_file(u->pipe->temp_file->file.name.data)
2061 == NGX_FILE_ERROR)
2062 {
2068 if (ngx_delete_file(tf->file.name.data) == NGX_FILE_ERROR) {
2069
20632070 ngx_log_error(NGX_LOG_CRIT, r->connection->log, ngx_errno,
20642071 ngx_delete_file_n " \"%s\" failed",
20652072 u->pipe->temp_file->file.name.data);
191191 ngx_table_elt_t *content_encoding;
192192 #endif
193193
194 off_t content_length_n;
195
194196 ngx_array_t cache_control;
195197 } ngx_http_upstream_headers_in_t;
196198