aboutsummaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorMaxim Dounin <mdounin@mdounin.ru>2011-10-05 10:14:21 +0000
committerMaxim Dounin <mdounin@mdounin.ru>2011-10-05 10:14:21 +0000
commit20139ff13adddd0fdf497a086615dac95ced6e8d (patch)
treee11b03118265d376eaa8167d9050171f61ba485a /src
parent3aba7688559b27374d7dfc262d5aef7bbaf6d98d (diff)
downloadnginx-20139ff13adddd0fdf497a086615dac95ced6e8d.tar.gz
nginx-20139ff13adddd0fdf497a086615dac95ced6e8d.zip
Fixed cache bypass caching of non-cacheable replies (ticket #21).
If cache was bypassed with proxy_cache_bypass, cache-controlling headers (Cache-Control, Expires) wasn't considered and response was cached even if it was actually non-cacheable. Patch by John Ferlito.
Diffstat (limited to 'src')
-rw-r--r--src/http/ngx_http_upstream.c6
1 files changed, 2 insertions, 4 deletions
diff --git a/src/http/ngx_http_upstream.c b/src/http/ngx_http_upstream.c
index 7e06b677e..89d21d860 100644
--- a/src/http/ngx_http_upstream.c
+++ b/src/http/ngx_http_upstream.c
@@ -683,6 +683,8 @@ ngx_http_upstream_cache(ngx_http_request_t *r, ngx_http_upstream_t *u)
return NGX_DECLINED;
}
+ u->cacheable = 1;
+
switch (ngx_http_test_predicates(r, u->conf->cache_bypass)) {
case NGX_ERROR:
@@ -696,8 +698,6 @@ ngx_http_upstream_cache(ngx_http_request_t *r, ngx_http_upstream_t *u)
break;
}
- u->cacheable = 1;
-
c = r->cache;
c->min_uses = u->conf->cache_min_uses;
@@ -2181,8 +2181,6 @@ ngx_http_upstream_send_response(ngx_http_request_t *r, ngx_http_upstream_t *u)
ngx_http_upstream_finalize_request(r, u, 0);
return;
}
-
- u->cacheable = 1;
}
break;