aboutsummaryrefslogtreecommitdiffstats
path: root/src/cowboy_http.erl
diff options
context:
space:
mode:
authorLoïc Hoguin <[email protected]>2017-04-18 16:07:01 +0200
committerLoïc Hoguin <[email protected]>2017-04-18 16:07:01 +0200
commit061cc227b17a9c7bcaae0b83fb689666781f6bf5 (patch)
tree1c47b6a6972cb30164c6535b6c4ad90839025fe7 /src/cowboy_http.erl
parent6e8b907ae25a7a988abbcd7206b978028c36f47e (diff)
downloadcowboy-061cc227b17a9c7bcaae0b83fb689666781f6bf5.tar.gz
cowboy-061cc227b17a9c7bcaae0b83fb689666781f6bf5.tar.bz2
cowboy-061cc227b17a9c7bcaae0b83fb689666781f6bf5.zip
Make the default 204 response go through stream handlers
Diffstat (limited to 'src/cowboy_http.erl')
-rw-r--r--src/cowboy_http.erl12
1 files changed, 6 insertions, 6 deletions
diff --git a/src/cowboy_http.erl b/src/cowboy_http.erl
index 983d95f..002944d 100644
--- a/src/cowboy_http.erl
+++ b/src/cowboy_http.erl
@@ -913,19 +913,19 @@ stream_reset(State, StreamID, StreamError={internal_error, _, _}) ->
% stream_terminate(State#state{out_state=done}, StreamID, StreamError).
stream_terminate(State, StreamID, StreamError).
-stream_terminate(State=#state{socket=Socket, transport=Transport,
+stream_terminate(State0=#state{socket=Socket, transport=Transport,
out_streamid=OutStreamID, out_state=OutState,
streams=Streams0, children=Children0}, StreamID, Reason) ->
{value, #stream{state=StreamState, version=Version}, Streams}
= lists:keytake(StreamID, #stream.id, Streams0),
- _ = case OutState of
+ State = case OutState of
wait ->
- %% @todo This should probably go through the stream handler info callback.
- Transport:send(Socket, cow_http:response(204, 'HTTP/1.1', []));
+ info(State0, StreamID, {response, 204, #{}, <<>>});
chunked when Version =:= 'HTTP/1.1' ->
- Transport:send(Socket, <<"0\r\n\r\n">>);
+ _ = Transport:send(Socket, <<"0\r\n\r\n">>),
+ State0;
_ -> %% done or Version =:= 'HTTP/1.0'
- ok
+ State0
end,
stream_call_terminate(StreamID, Reason, StreamState),