diff options
author | Justin Li <jli.justinli@gmail.com> | 2016-03-08 22:31:55 -0500 |
---|---|---|
committer | Justin Li <jli.justinli@gmail.com> | 2016-03-08 22:31:55 -0500 |
commit | 573ec98d2425bf5edc22d8e5e7edd17c6391d9b1 (patch) | |
tree | e718afe8714aeab2f4a56e023b0d028878a8de96 /src/core/ngx_module.c | |
parent | 2aa6d7fd65b2c423ffc8fa9d171efd28c994acde (diff) | |
download | nginx-573ec98d2425bf5edc22d8e5e7edd17c6391d9b1.tar.gz nginx-573ec98d2425bf5edc22d8e5e7edd17c6391d9b1.zip |
Upstream: avoid closing client connection in edge case.
If proxy_cache is enabled, and proxy_no_cache tests true, it was previously
possible for the client connection to be closed after a 304. The fix is to
recheck r->header_only after the final cacheability is determined, and end the
request if no longer cacheable.
Example configuration:
proxy_cache foo;
proxy_cache_bypass 1;
proxy_no_cache 1;
If a client sends If-None-Match, and the upstream server returns 200 with a
matching ETag, no body should be returned to the client. At the start of
ngx_http_upstream_send_response proxy_no_cache is not yet tested, thus cacheable
is still 1 and downstream_error is set.
However, by the time the downstream_error check is done in process_request,
proxy_no_cache has been tested and cacheable is set to 0. The client connection
is then closed, regardless of keepalive.
Diffstat (limited to 'src/core/ngx_module.c')
0 files changed, 0 insertions, 0 deletions