mirror of
https://github.com/ninenines/cowboy.git
synced 2025-07-14 20:30:23 +00:00
Don't close requests when the replied body is chunked
This commit is contained in:
parent
8e2cc3d7f1
commit
7e74582432
1 changed files with 4 additions and 4 deletions
|
@ -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.
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue