Browse Source

Fix error responses not including a content-length

This would prevent the client from knowing whether the request
was received fully without the connection closing first.
Loïc Hoguin 8 years ago
parent
commit
3b91523a3c
1 changed files with 1 additions and 1 deletions
  1. 1 1
      src/cowboy_stream_h.erl

+ 1 - 1
src/cowboy_stream_h.erl

@@ -75,7 +75,7 @@ info(_StreamID, {'EXIT', Pid, {_Reason, [_, {cow_http_hd, _, _, _}|_]}}, State=#
 	%% @todo Have an option to enable/disable this specific crash report?
 	%%report_crash(Ref, StreamID, Pid, Reason, Stacktrace),
 	%% @todo Headers? Details in body? More stuff in debug only?
-	{[{error_response, 400, #{}, <<>>}, stop], State};
+	{[{error_response, 400, #{<<"content-length">> => <<"0">>}, <<>>}, stop], State};
 info(StreamID, Exit = {'EXIT', Pid, {Reason, Stacktrace}}, State=#state{ref=Ref, pid=Pid}) ->
 	report_crash(Ref, StreamID, Pid, Reason, Stacktrace),
 	{[