Mercurial > hg > nginx-vendor-current
comparison src/http/ngx_http_file_cache.c @ 654:753f505670e0 NGINX_1_1_11
nginx 1.1.11
*) Feature: the "so_keepalive" parameter of the "listen" directive.
Thanks to Vsevolod Stakhov.
*) Feature: the "if_not_empty" parameter of the
"fastcgi/scgi/uwsgi_param" directives.
*) Feature: the $https variable.
*) Feature: the "proxy_redirect" directive supports variables in the
first parameter.
*) Feature: the "proxy_redirect" directive supports regular expressions.
*) Bugfix: the $sent_http_cache_control variable might contain a wrong
value if the "expires" directive was used.
Thanks to Yichun Zhang.
*) Bugfix: the "read_ahead" directive might not work combined with
"try_files" and "open_file_cache".
*) Bugfix: a segmentation fault might occur in a worker process if small
time was used in the "inactive" parameter of the "proxy_cache_path"
directive.
*) Bugfix: responses from cache might hang.
author | Igor Sysoev <http://sysoev.ru> |
---|---|
date | Mon, 12 Dec 2011 00:00:00 +0400 |
parents | d3cf6c6b0043 |
children | 9d21dad0b5a1 |
comparison
equal
deleted
inserted
replaced
653:8c96af2112c1 | 654:753f505670e0 |
---|---|
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; |
1104 (void) ngx_hex_dump(p, fcn->key, len); | 1111 (void) ngx_hex_dump(p, fcn->key, len); |
1105 | 1112 |
1106 /* | 1113 /* |
1107 * abnormally exited workers may leave locked cache entries, | 1114 * abnormally exited workers may leave locked cache entries, |
1108 * and although it may be safe to remove them completely, | 1115 * and although it may be safe to remove them completely, |
1109 * we prefer to remove them from inactive queue and rbtree | 1116 * we prefer to just move them to the top of the inactive queue |
1110 * only, and to allow other leaks | |
1111 */ | 1117 */ |
1112 | 1118 |
1113 ngx_queue_remove(q); | 1119 ngx_queue_remove(q); |
1114 ngx_rbtree_delete(&cache->sh->rbtree, &fcn->node); | 1120 fcn->expire = ngx_time() + cache->inactive; |
1121 ngx_queue_insert_head(&cache->sh->queue, &fcn->queue); | |
1115 | 1122 |
1116 ngx_log_error(NGX_LOG_ALERT, ngx_cycle->log, 0, | 1123 ngx_log_error(NGX_LOG_ALERT, ngx_cycle->log, 0, |
1117 "ignore long locked inactive cache entry %*s, count:%d", | 1124 "ignore long locked inactive cache entry %*s, count:%d", |
1118 2 * NGX_HTTP_CACHE_KEY_LEN, key, fcn->count); | 1125 2 * NGX_HTTP_CACHE_KEY_LEN, key, fcn->count); |
1119 } | 1126 } |
1750 v->valid = valid; | 1757 v->valid = valid; |
1751 } | 1758 } |
1752 | 1759 |
1753 return NGX_CONF_OK; | 1760 return NGX_CONF_OK; |
1754 } | 1761 } |
1755 | |
1756 | |
1757 ngx_int_t | |
1758 ngx_http_cache(ngx_http_request_t *r, ngx_array_t *no_cache) | |
1759 { | |
1760 ngx_str_t val; | |
1761 ngx_uint_t i; | |
1762 ngx_http_complex_value_t *cv; | |
1763 | |
1764 cv = no_cache->elts; | |
1765 | |
1766 for (i = 0; i < no_cache->nelts; i++) { | |
1767 if (ngx_http_complex_value(r, &cv[i], &val) != NGX_OK) { | |
1768 return NGX_ERROR; | |
1769 } | |
1770 | |
1771 if (val.len && val.data[0] != '0') { | |
1772 return NGX_DECLINED; | |
1773 } | |
1774 } | |
1775 | |
1776 return NGX_OK; | |
1777 } | |
1778 | |
1779 | |
1780 char * | |
1781 ngx_http_no_cache_set_slot(ngx_conf_t *cf, ngx_command_t *cmd, void *conf) | |
1782 { | |
1783 char *p = conf; | |
1784 | |
1785 ngx_str_t *value; | |
1786 ngx_uint_t i; | |
1787 ngx_array_t **a; | |
1788 ngx_http_complex_value_t *cv; | |
1789 ngx_http_compile_complex_value_t ccv; | |
1790 | |
1791 a = (ngx_array_t **) (p + cmd->offset); | |
1792 | |
1793 if (*a == NGX_CONF_UNSET_PTR) { | |
1794 *a = ngx_array_create(cf->pool, 1, sizeof(ngx_http_complex_value_t)); | |
1795 if (*a == NULL) { | |
1796 return NGX_CONF_ERROR; | |
1797 } | |
1798 } | |
1799 | |
1800 value = cf->args->elts; | |
1801 | |
1802 for (i = 1; i < cf->args->nelts; i++) { | |
1803 cv = ngx_array_push(*a); | |
1804 if (cv == NULL) { | |
1805 return NGX_CONF_ERROR; | |
1806 } | |
1807 | |
1808 ngx_memzero(&ccv, sizeof(ngx_http_compile_complex_value_t)); | |
1809 | |
1810 ccv.cf = cf; | |
1811 ccv.value = &value[i]; | |
1812 ccv.complex_value = cv; | |
1813 | |
1814 if (ngx_http_compile_complex_value(&ccv) != NGX_OK) { | |
1815 return NGX_CONF_ERROR; | |
1816 } | |
1817 } | |
1818 | |
1819 return NGX_CONF_OK; | |
1820 } |