mirror of
https://github.com/nginx/nginx.git
synced 2025-06-07 17:52:38 +08:00
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.
This commit is contained in:
parent
3aba768855
commit
20139ff13a
@ -683,6 +683,8 @@ ngx_http_upstream_cache(ngx_http_request_t *r, ngx_http_upstream_t *u)
|
|||||||
return NGX_DECLINED;
|
return NGX_DECLINED;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
u->cacheable = 1;
|
||||||
|
|
||||||
switch (ngx_http_test_predicates(r, u->conf->cache_bypass)) {
|
switch (ngx_http_test_predicates(r, u->conf->cache_bypass)) {
|
||||||
|
|
||||||
case NGX_ERROR:
|
case NGX_ERROR:
|
||||||
@ -696,8 +698,6 @@ ngx_http_upstream_cache(ngx_http_request_t *r, ngx_http_upstream_t *u)
|
|||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
|
||||||
u->cacheable = 1;
|
|
||||||
|
|
||||||
c = r->cache;
|
c = r->cache;
|
||||||
|
|
||||||
c->min_uses = u->conf->cache_min_uses;
|
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);
|
ngx_http_upstream_finalize_request(r, u, 0);
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
u->cacheable = 1;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
break;
|
break;
|
||||||
|
Loading…
Reference in New Issue
Block a user