Welcome! Log In Create A New Profile

Advanced

[nginx] svn commit: r4299 - trunk/src/http

Anonymous User
November 18, 2011 10:10AM
Author: mdounin
Date: 2011-11-18 15:09:08 +0000 (Fri, 18 Nov 2011)
New Revision: 4299

Log:
Upstream: don't cache unfinished responses.

Check if received data length match Content-Length header (if present),
don't cache response if no match found. This prevents caching of corrupted
response in case of premature connection close by upstream.


Modified:
trunk/src/http/ngx_http_upstream.c

Modified: trunk/src/http/ngx_http_upstream.c
===================================================================
--- trunk/src/http/ngx_http_upstream.c 2011-11-18 14:41:01 UTC (rev 4298)
+++ trunk/src/http/ngx_http_upstream.c 2011-11-18 15:09:08 UTC (rev 4299)
@@ -2696,10 +2696,18 @@

} else if (p->upstream_eof) {

- /* TODO: check length & update cache */
+ tf = u->pipe->temp_file;

- ngx_http_file_cache_update(r, u->pipe->temp_file);
+ if (u->headers_in.content_length_n == -1
+ || u->headers_in.content_length_n
+ == tf->offset - (off_t) r->cache->body_start)
+ {
+ ngx_http_file_cache_update(r, tf);

+ } else {
+ ngx_http_file_cache_free(r->cache, tf);
+ }
+
} else if (p->upstream_error) {
ngx_http_file_cache_free(r->cache, u->pipe->temp_file);
}

_______________________________________________
nginx-devel mailing list
nginx-devel@nginx.org
http://mailman.nginx.org/mailman/listinfo/nginx-devel
Subject Author Views Posted

[nginx] svn commit: r4299 - trunk/src/http

Anonymous User 1144 November 18, 2011 10:10AM



Sorry, you do not have permission to post/reply in this forum.

Online Users

Guests: 96
Record Number of Users: 6 on February 13, 2018
Record Number of Guests: 421 on December 02, 2018
Powered by nginx      Powered by FreeBSD      PHP Powered      Powered by MariaDB      ipv6 ready