[PATCH] Upstream: avoid closing connection when no client body needed

Justin Li jli.justinli at gmail.com
Wed Mar 9 01:56:11 UTC 2016

Thanks for your feedback Maxim!

On Wed, Mar 09, 2016 at 01:13:46, Maxim Dounin wrote:

> So you are trying to optimize a specific case with proxy_no_cache
> in addition to what 35990c69b3ac fixed, right?

Yes, as you figured, this is about preventing the client connection from
closed when the client response is header_only and the upstream response
switches from cacheable to not cacheable between the header_only check
and downstream_error check. Sorry for the vagueness.

> What about explicitly handling the proxy_no_cache case right
> after the proxy_no_cache cache check, much like it is already done
> with cache object (see ngx_http_file_cache_free() call)?
> (Additionally, the code between the no_cache test and the
> ngx_http_file_cache_free() call also shows that lack of
> proxy_cache_valid and/or explicit cache validity headers can lead
> to the same behaviour.)

I assume you mean something like calling
if (r->header_only && !u->cacheable && !u->store) after the referenced call
ngx_http_file_cache_free(). I'll submit another patch after testing to
confirm it
fully fixes our issue unless you object to that interpretation.

Justin Li
Developer @ Shopify
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://mailman.nginx.org/pipermail/nginx-devel/attachments/20160308/69d098cd/attachment.html>

More information about the nginx-devel mailing list