diff options
author | Maxim Dounin <mdounin@mdounin.ru> | 2011-12-12 10:47:48 +0000 |
---|---|---|
committer | Maxim Dounin <mdounin@mdounin.ru> | 2011-12-12 10:47:48 +0000 |
commit | 64a9f700929dbc8f0730be4f91cc3bbfde8fc3e6 (patch) | |
tree | 11f67773d431f7539464fc9489102796929207cc /src | |
parent | b839e6febb5c32bd3649d1e60cdc40d42efffe43 (diff) | |
download | nginx-64a9f700929dbc8f0730be4f91cc3bbfde8fc3e6.tar.gz nginx-64a9f700929dbc8f0730be4f91cc3bbfde8fc3e6.zip |
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
Diffstat (limited to 'src')
-rw-r--r-- | src/http/ngx_http_file_cache.c | 7 |
1 files changed, 7 insertions, 0 deletions
diff --git a/src/http/ngx_http_file_cache.c b/src/http/ngx_http_file_cache.c index 6a363220d..cb329aa9b 100644 --- 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_request_t *r, ngx_http_cache_t *c) 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; |