Mercurial > hg > nginx
comparison src/http/ngx_http_file_cache.c @ 3597:0d8b8c84bab7 stable-0.7
merge r3518, r3527:
cache related fixes:
*) do not cache response if it has "no-store" or "private"
in "Cache-Control" header
*) proxy_no_cache and fastcgi_no_cache
author | Igor Sysoev <igor@sysoev.ru> |
---|---|
date | Mon, 07 Jun 2010 12:23:23 +0000 |
parents | e1409e56ba7c |
children |
comparison
equal
deleted
inserted
replaced
3596:555de5bdb800 | 3597:0d8b8c84bab7 |
---|---|
1602 v->valid = valid; | 1602 v->valid = valid; |
1603 } | 1603 } |
1604 | 1604 |
1605 return NGX_CONF_OK; | 1605 return NGX_CONF_OK; |
1606 } | 1606 } |
1607 | |
1608 | |
1609 ngx_int_t | |
1610 ngx_http_cache(ngx_http_request_t *r, ngx_array_t *no_cache) | |
1611 { | |
1612 ngx_str_t val; | |
1613 ngx_uint_t i; | |
1614 ngx_http_complex_value_t *cv; | |
1615 | |
1616 cv = no_cache->elts; | |
1617 | |
1618 for (i = 0; i < no_cache->nelts; i++) { | |
1619 if (ngx_http_complex_value(r, &cv[i], &val) != NGX_OK) { | |
1620 return NGX_ERROR; | |
1621 } | |
1622 | |
1623 if (val.len && val.data[0] != '0') { | |
1624 return NGX_DECLINED; | |
1625 } | |
1626 } | |
1627 | |
1628 return NGX_OK; | |
1629 } | |
1630 | |
1631 | |
1632 char * | |
1633 ngx_http_no_cache_set_slot(ngx_conf_t *cf, ngx_command_t *cmd, void *conf) | |
1634 { | |
1635 char *p = conf; | |
1636 | |
1637 ngx_str_t *value; | |
1638 ngx_uint_t i; | |
1639 ngx_array_t **a; | |
1640 ngx_http_complex_value_t *cv; | |
1641 ngx_http_compile_complex_value_t ccv; | |
1642 | |
1643 a = (ngx_array_t **) (p + cmd->offset); | |
1644 | |
1645 if (*a == NGX_CONF_UNSET_PTR) { | |
1646 *a = ngx_array_create(cf->pool, 1, sizeof(ngx_http_complex_value_t)); | |
1647 if (*a == NULL) { | |
1648 return NGX_CONF_ERROR; | |
1649 } | |
1650 } | |
1651 | |
1652 value = cf->args->elts; | |
1653 | |
1654 for (i = 1; i < cf->args->nelts; i++) { | |
1655 cv = ngx_array_push(*a); | |
1656 if (cv == NULL) { | |
1657 return NGX_CONF_ERROR; | |
1658 } | |
1659 | |
1660 ngx_memzero(&ccv, sizeof(ngx_http_compile_complex_value_t)); | |
1661 | |
1662 ccv.cf = cf; | |
1663 ccv.value = &value[i]; | |
1664 ccv.complex_value = cv; | |
1665 | |
1666 if (ngx_http_compile_complex_value(&ccv) != NGX_OK) { | |
1667 return NGX_CONF_ERROR; | |
1668 } | |
1669 } | |
1670 | |
1671 return NGX_CONF_OK; | |
1672 } |