aboutsummaryrefslogtreecommitdiffstats
path: root/src/cowboy_http_protocol.erl
diff options
context:
space:
mode:
authorLoïc Hoguin <[email protected]>2012-03-15 23:05:40 +0100
committerLoïc Hoguin <[email protected]>2012-03-15 23:05:40 +0100
commit7e745824324187ed7b4559bc7c4eb6e40e87567c (patch)
tree6b9e7f4c2d7c93453958a3a14b4c98a2a2070f3c /src/cowboy_http_protocol.erl
parent8e2cc3d7f1c30212450e36f9ae725244e79451fb (diff)
downloadcowboy-7e745824324187ed7b4559bc7c4eb6e40e87567c.tar.gz
cowboy-7e745824324187ed7b4559bc7c4eb6e40e87567c.tar.bz2
cowboy-7e745824324187ed7b4559bc7c4eb6e40e87567c.zip
Don't close requests when the replied body is chunked
Diffstat (limited to 'src/cowboy_http_protocol.erl')
-rw-r--r--src/cowboy_http_protocol.erl8
1 files changed, 4 insertions, 4 deletions
diff --git a/src/cowboy_http_protocol.erl b/src/cowboy_http_protocol.erl
index c5a6f7f..6125d83 100644
--- a/src/cowboy_http_protocol.erl
+++ b/src/cowboy_http_protocol.erl
@@ -410,15 +410,15 @@ ensure_response(#http_req{resp_state=done}) ->
ensure_response(Req=#http_req{resp_state=waiting}) ->
_ = cowboy_http_req:reply(204, [], [], Req),
ok;
-%% Close the chunked reply.
+%% Terminate the chunked body for HTTP/1.1 only.
ensure_response(#http_req{method='HEAD', resp_state=chunks}) ->
- close;
+ ok;
ensure_response(#http_req{version={1, 0}, resp_state=chunks}) ->
- close;
+ ok;
ensure_response(#http_req{socket=Socket, transport=Transport,
resp_state=chunks}) ->
Transport:send(Socket, <<"0\r\n\r\n">>),
- close.
+ ok.
%% Only send an error reply if there is no resp_sent message.
-spec error_terminate(cowboy_http:status(), #state{}) -> ok.