diff options
author | Loïc Hoguin <[email protected]> | 2018-11-14 19:24:39 +0100 |
---|---|---|
committer | Loïc Hoguin <[email protected]> | 2018-11-14 19:24:39 +0100 |
commit | 292039362a6125dfd0a163d5b0a49b800bf80b11 (patch) | |
tree | 31a38f67960503ece6abfa82a0d285152d8dc4ff /src/cowboy_http.erl | |
parent | 4fedb336311604253153eafe81f33a77b44a0b2f (diff) | |
download | cowboy-292039362a6125dfd0a163d5b0a49b800bf80b11.tar.gz cowboy-292039362a6125dfd0a163d5b0a49b800bf80b11.tar.bz2 cowboy-292039362a6125dfd0a163d5b0a49b800bf80b11.zip |
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.
Diffstat (limited to 'src/cowboy_http.erl')
-rw-r--r-- | src/cowboy_http.erl | 2 |
1 files changed, 2 insertions, 0 deletions
diff --git a/src/cowboy_http.erl b/src/cowboy_http.erl index caa4932..56a4af8 100644 --- a/src/cowboy_http.erl +++ b/src/cowboy_http.erl @@ -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. |