diff options
| author | Igor Sysoev <igor@sysoev.ru> | 2010-05-24 11:01:05 +0000 |
|---|---|---|
| committer | Igor Sysoev <igor@sysoev.ru> | 2010-05-24 11:01:05 +0000 |
| commit | 9b2763a245e51032734089672a8a74611a288fae (patch) | |
| tree | 7ee770dbac28d73819b6f3374e90f060c7828016 /src/http/ngx_http_file_cache.c | |
| parent | fbb262533f8fec6dd2e05f9954225f3077391291 (diff) | |
| download | nginx-9b2763a245e51032734089672a8a74611a288fae.tar.gz nginx-9b2763a245e51032734089672a8a74611a288fae.tar.bz2 | |
proxy_no_cache and fastcgi_no_cache
Diffstat (limited to 'src/http/ngx_http_file_cache.c')
| -rw-r--r-- | src/http/ngx_http_file_cache.c | 66 |
1 files changed, 66 insertions, 0 deletions
diff --git a/src/http/ngx_http_file_cache.c b/src/http/ngx_http_file_cache.c index aa6998b53..277475179 100644 --- a/src/http/ngx_http_file_cache.c +++ b/src/http/ngx_http_file_cache.c @@ -1692,3 +1692,69 @@ ngx_http_file_cache_valid_set_slot(ngx_conf_t *cf, ngx_command_t *cmd, return NGX_CONF_OK; } + + +ngx_int_t +ngx_http_cache(ngx_http_request_t *r, ngx_array_t *no_cache) +{ + ngx_str_t val; + ngx_uint_t i; + ngx_http_complex_value_t *cv; + + cv = no_cache->elts; + + for (i = 0; i < no_cache->nelts; i++) { + if (ngx_http_complex_value(r, &cv[i], &val) != NGX_OK) { + return NGX_ERROR; + } + + if (val.len && val.data[0] != '0') { + return NGX_DECLINED; + } + } + + return NGX_OK; +} + + +char * +ngx_http_no_cache_set_slot(ngx_conf_t *cf, ngx_command_t *cmd, void *conf) +{ + char *p = conf; + + ngx_str_t *value; + ngx_uint_t i; + ngx_array_t **a; + ngx_http_complex_value_t *cv; + ngx_http_compile_complex_value_t ccv; + + a = (ngx_array_t **) (p + cmd->offset); + + if (*a == NGX_CONF_UNSET_PTR) { + *a = ngx_array_create(cf->pool, 1, sizeof(ngx_http_complex_value_t)); + if (*a == NULL) { + return NGX_CONF_ERROR; + } + } + + value = cf->args->elts; + + for (i = 1; i < cf->args->nelts; i++) { + cv = ngx_array_push(*a); + if (cv == NULL) { + return NGX_CONF_ERROR; + } + + ngx_memzero(&ccv, sizeof(ngx_http_compile_complex_value_t)); + + ccv.cf = cf; + ccv.value = &value[i]; + ccv.complex_value = cv; + + if (ngx_http_compile_complex_value(&ccv) != NGX_OK) { + return NGX_CONF_ERROR; + } + } + + return NGX_CONF_OK; +} |
