Allow Cowboy to stream the response instead of chunk it
!4062 (merged) was merged to fix Bandit as proxying through Varnish was erroring due to seeing both Transfer-Encoding: Chunked
and Content-Length
headers as this is an RFC violation. It was unclear how Cowboy was handling this just fine and was ignored.
It turns out that Cowboy has special handling here and when it sees the Content-Length
header it will stream the response instead of chunk it. This reduces the odds of a killed connection during the delivery of an image to be cached by a proxy because it will know the data received did not match the Content-Length
header. Broken images as observed in #3278 (closed) are less likely as a result.
https://github.com/elixir-plug/plug/issues/492#issuecomment-429487065
Edited by feld