aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorLoïc Hoguin <[email protected]>2016-06-06 17:26:00 +0200
committerLoïc Hoguin <[email protected]>2016-06-06 17:26:13 +0200
commit7603518ed013e3b826c9056b80220cdbe4ff9422 (patch)
treef45ccba042eb85762618f5aa51b948898cdae6e3
parent327e8db623d988151f53498fe869fc8cd782b913 (diff)
downloadcowboy-7603518ed013e3b826c9056b80220cdbe4ff9422.tar.gz
cowboy-7603518ed013e3b826c9056b80220cdbe4ff9422.tar.bz2
cowboy-7603518ed013e3b826c9056b80220cdbe4ff9422.zip
HTTP/1.1: Don't send 500 errors twice
The stream handler is responsible for sending errors. The protocol should only send errors when no responses were sent (this might not work yet).
-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 4608839..e93045d 100644
--- a/src/cowboy_http.erl
+++ b/src/cowboy_http.erl
@@ -900,15 +900,15 @@ maybe_terminate(State=#state{last_streamid=StreamID}, StreamID, _Tail, fin) ->
maybe_terminate(State, StreamID, _Tail, fin) ->
stream_terminate(State, StreamID, normal).
-stream_reset(State=#state{socket=Socket, transport=Transport}, StreamID,
- StreamError={internal_error, _, _}) ->
+stream_reset(State, StreamID, StreamError={internal_error, _, _}) ->
%% @todo headers
%% @todo Don't send this if there are no streams left.
- Transport:send(Socket, cow_http:response(500, 'HTTP/1.1', [
- {<<"content-length">>, <<"0">>}
- ])),
+% Transport:send(Socket, cow_http:response(500, 'HTTP/1.1', [
+% {<<"content-length">>, <<"0">>}
+% ])),
%% @todo update IsFin local
- stream_terminate(State#state{out_state=done}, StreamID, StreamError).
+% stream_terminate(State#state{out_state=done}, StreamID, StreamError).
+ stream_terminate(State, StreamID, StreamError).
stream_terminate(State=#state{socket=Socket, transport=Transport, handler=Handler,
out_streamid=OutStreamID, out_state=OutState,