Welcome! Log In Create A New Profile

Advanced

[PATCH 2 of 5] Cache: handling of cache files with long headers

Maxim Dounin
December 11, 2011 10:06AM
# HG changeset patch
# User Maxim Dounin <mdounin@mdounin.ru>
# Date 1323366111 -10800
# Node ID a013347f89334734a7a0f65031895be52d87a5a0
# Parent 64e354fb95e4ea72f479213ee4e8b4274413ce4f
Cache: handling of cache files with long headers.

There are two possible situations which can lead to this: response was
cached with bigger proxy_buffer_size value (and nginx was restared since
then, i.e. shared memory zone content was lost), or due to the race in
the cache update code (see [1]) we've end up with fcn->body_start from
a different response stored in shared memory zone.

[1] http://mailman.nginx.org/pipermail/nginx-devel/2011-September/001287.html

diff --git a/src/http/ngx_http_file_cache.c b/src/http/ngx_http_file_cache.c
--- a/src/http/ngx_http_file_cache.c
+++ b/src/http/ngx_http_file_cache.c
@@ -386,6 +386,13 @@ ngx_http_file_cache_read(ngx_http_reques
return NGX_DECLINED;
}

+ if (h->body_start > c->body_start) {
+ ngx_log_error(NGX_LOG_CRIT, r->connection->log, 0,
+ "cache file \"%s\" has too long header",
+ c->file.name.data);
+ return NGX_DECLINED;
+ }
+
c->buf->last += n;

c->valid_sec = h->valid_sec;

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

[PATCH 0 of 5] cache patches

Maxim Dounin 1698 December 11, 2011 10:06AM

[PATCH 1 of 5] Cache: obsolete code removed

Maxim Dounin 668 December 11, 2011 10:06AM

[PATCH 2 of 5] Cache: handling of cache files with long headers

Maxim Dounin 856 December 11, 2011 10:06AM

[PATCH 3 of 5] Cache: only complain on long locked entries

Maxim Dounin 849 December 11, 2011 10:06AM

[PATCH 4 of 5] Cache locks initial implementation

Maxim Dounin 811 December 11, 2011 10:06AM

[PATCH 5 of 5] Cache lock support for fastcgi, scgi, uwsgi

Maxim Dounin 669 December 11, 2011 10:08AM

Re: [PATCH 0 of 5] cache patches

fanboy 904 December 11, 2011 07:00PM

Re: [PATCH 0 of 5] cache patches

Maxim Dounin 695 December 12, 2011 04:54AM

Re: [PATCH 0 of 5] cache patches

António P. P. Almeida 708 December 11, 2011 07:10PM

Re: [PATCH 0 of 5] cache patches

Maxim Dounin 676 December 12, 2011 05:02AM

Re: [PATCH 0 of 5] cache patches

António P. P. Almeida 654 December 12, 2011 05:28AM

Re: [PATCH 0 of 5] cache patches

Maxim Dounin 710 December 12, 2011 05:36AM

Re: [PATCH 0 of 5] cache patches

António P. P. Almeida 984 December 13, 2011 02:42PM



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

Online Users

Guests: 274
Record Number of Users: 8 on April 13, 2023
Record Number of Guests: 421 on December 02, 2018
Powered by nginx      Powered by FreeBSD      PHP Powered      Powered by MariaDB      ipv6 ready