comparison src/http/ngx_http_file_cache.c @ 4339:6f97afc238de

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
author Maxim Dounin <mdounin@mdounin.ru>
date Mon, 12 Dec 2011 10:47:48 +0000
parents 02b558fce98a
children 4533d7684e14
comparison
equal deleted inserted replaced
4338:02b558fce98a 4339:6f97afc238de
384 ngx_log_error(NGX_LOG_CRIT, r->connection->log, 0, 384 ngx_log_error(NGX_LOG_CRIT, r->connection->log, 0,
385 "cache file \"%s\" has md5 collision", c->file.name.data); 385 "cache file \"%s\" has md5 collision", c->file.name.data);
386 return NGX_DECLINED; 386 return NGX_DECLINED;
387 } 387 }
388 388
389 if (h->body_start > c->body_start) {
390 ngx_log_error(NGX_LOG_CRIT, r->connection->log, 0,
391 "cache file \"%s\" has too long header",
392 c->file.name.data);
393 return NGX_DECLINED;
394 }
395
389 c->buf->last += n; 396 c->buf->last += n;
390 397
391 c->valid_sec = h->valid_sec; 398 c->valid_sec = h->valid_sec;
392 c->last_modified = h->last_modified; 399 c->last_modified = h->last_modified;
393 c->date = h->date; 400 c->date = h->date;