<div dir="ltr"><div><div class="gmail_quote">Another mistake in the message... that <span style="font-size:12.8px">proxy_cache_bypass should be </span><span style="font-size:12.8px">proxy_no_cache.</span></div><div class="gmail_quote"><br></div></div>I'm not sure I understand exactly how this was functioning beforehand. In the case of a cacheable response, if <span style="font-size:12.8px">downstream_error is 1, then won't ngx_event_pipe_drain_chains be called? Why does that case not have the same issues with busy buffers as previously described?</span><div><span style="font-size:12.8px"><br></span></div><div><span style="font-size:12.8px">--</span></div><div><span style="font-size:12.8px">Justin Li</span></div><div><span style="font-size:12.8px">Developer @ Shopify<br></span><div class="gmail_extra"><br><div class="gmail_quote">On Tue, Mar 8, 2016 at 9:29 PM, Justin Li <span dir="ltr"><<a href="mailto:jli.justinli@gmail.com" target="_blank">jli.justinli@gmail.com</a>></span> wrote:<br><blockquote class="gmail_quote" style="margin:0px 0px 0px 0.8ex;border-left-width:1px;border-left-color:rgb(204,204,204);border-left-style:solid;padding-left:1ex"># HG changeset patch<br>
# User Justin Li <<a href="mailto:jli.justinli@gmail.com">jli.justinli@gmail.com</a>><br>
# Date 1457490530 18000<br>
# Tue Mar 08 21:28:50 2016 -0500<br>
# Node ID e9f916f271b86e446c6f1de371832432a9f2a66d<br>
# Parent c5f81dcf97a79576138917501c9a6cc6f53ee930<br>
Upstream: avoid closing client conn when no response body needed<br>
<br>
If proxy_cache is enabled, and proxy_cache_bypass tests true, it was previously<br>
possible for the client connection to be closed after a 304. The fix is to<br>
recheck r->header_only after the final cacheability is determined, and end the<br>
request if no longer cacheable.<br>
<br>
diff -r c5f81dcf97a7 -r e9f916f271b8 src/http/ngx_http_upstream.c<br>
--- a/src/http/ngx_http_upstream.c Thu Mar 03 21:14:19 2016 +0300<br>
+++ b/src/http/ngx_http_upstream.c Tue Mar 08 21:28:50 2016 -0500<br>
@@ -2861,6 +2861,12 @@ ngx_http_upstream_send_response(ngx_http<br>
ngx_http_file_cache_free(r->cache, u->pipe->temp_file);<br>
}<br>
<br>
+ if (r->header_only && !u->cacheable && !u->store) {<br>
+ u->pipe->downstream_error = 0;<br>
+ ngx_http_upstream_finalize_request(r, u, rc);<br>
+ return;<br>
+ }<br>
+<br>
#endif<br>
<br>
p = u->pipe;<br>
</blockquote></div><br></div></div></div>