mirror of
https://github.com/ninenines/cowboy.git
synced 2025-07-14 12:20:24 +00:00
Don't send the content-length header in empty 304 responses
It's OK to send it when set explicitly, as it can be set to what the representation's size would have been.
This commit is contained in:
parent
4fedb33631
commit
292039362a
4 changed files with 74 additions and 5 deletions
|
@ -963,6 +963,8 @@ commands(State0=#state{socket=Socket, transport=Transport, streams=Streams0, out
|
|||
{State1, Headers1} = case {Status, ContentLength, Version} of
|
||||
{204, _, 'HTTP/1.1'} ->
|
||||
{State0#state{out_state=done}, Headers0};
|
||||
{304, _, 'HTTP/1.1'} ->
|
||||
{State0#state{out_state=done}, Headers0};
|
||||
{_, undefined, 'HTTP/1.1'} ->
|
||||
{State0#state{out_state=chunked}, Headers0#{<<"transfer-encoding">> => <<"chunked">>}};
|
||||
%% Close the connection after streaming without content-length to HTTP/1.0 client.
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue