Klaus Demo nginx / 187f394
Upstream: fixed store/cache of unfinished responses. In case of upstream eof, only responses with u->pipe->length == -1 are now cached/stored. This ensures that unfinished chunked responses are not cached. Note well - previously used checks for u->headers_in.content_length_n are preserved. This provides an additional level of protection if protol data disagree with Content-Length header provided (e.g., a FastCGI response is sent with wrong Content-Length, or an incomple SCGI or uwsgi response), as well as protects from storing of responses to HEAD requests. This should be reconsidered if we'll consider caching of responses to HEAD requests. Maxim Dounin 8 years ago
1 changed file(s) with 5 addition(s) and 3 deletion(s). Raw diff Collapse all Expand all
29842984 tf = p->temp_file;
29852985
29862986 if (u->headers_in.status_n == NGX_HTTP_OK
2987 && (p->upstream_done || p->length == -1)
29872988 && (u->headers_in.content_length_n == -1
29882989 || u->headers_in.content_length_n == tf->offset))
29892990 {
30043005
30053006 tf = p->temp_file;
30063007
3007 if (u->headers_in.content_length_n == -1
3008 || u->headers_in.content_length_n
3009 == tf->offset - (off_t) r->cache->body_start)
3008 if (p->length == -1
3009 && (u->headers_in.content_length_n == -1
3010 || u->headers_in.content_length_n
3011 == tf->offset - (off_t) r->cache->body_start))
30103012 {
30113013 ngx_http_file_cache_update(r, tf);
30123014