From 7603518ed013e3b826c9056b80220cdbe4ff9422 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Lo=C3=AFc=20Hoguin?= Date: Mon, 6 Jun 2016 17:26:00 +0200 Subject: 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). --- src/cowboy_http.erl | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-) (limited to 'src/cowboy_http.erl') 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, -- cgit v1.2.3