Closed joachimschmidt557 closed 3 years ago
Thanks. There are actually a few cases where we must not emit this header at all. I'm planning to rewrite the entire Response
logic, but your fix will at least ensure that http clients will not wait infinitely for the server to close the connection on empty bodies.
Thanks once again!
According to the spec, a
Content-Length
of zero is allowed. Furthermore, according to the spec, when not supplyingContent-Length
, the server must close the connection in order to signal the end of the response, which is not always the case (as keep-alive may be enabled). So the best solution would be to include theContent-Length
header even if the response is empty.