comparison src/http/ngx_http_file_cache.c @ 4338:02b558fce98a

Cache: obsolete code removed. The ngx_http_cache() and ngx_http_no_cache_set_slot() functions were replaced by ngx_http_test_predicates() and ngx_http_set_predicate_slot() in 0.8.46 and no longer used since then.
author Maxim Dounin <mdounin@mdounin.ru>
date Mon, 12 Dec 2011 10:46:43 +0000
parents b9ee14871bf1
children 6f97afc238de
comparison
equal deleted inserted replaced
4337:68b28a88749d 4338:02b558fce98a
1750 v->valid = valid; 1750 v->valid = valid;
1751 } 1751 }
1752 1752
1753 return NGX_CONF_OK; 1753 return NGX_CONF_OK;
1754 } 1754 }
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 }