mirror of
https://github.com/ninenines/cowboy.git
synced 2025-07-14 20:30:23 +00:00
Fixing badmatch when browser closes connection earlier than file was fully sent
This commit is contained in:
parent
7e74582432
commit
6e0b764e0a
1 changed files with 4 additions and 2 deletions
|
@ -316,8 +316,10 @@ sfallback(Transport, Socket, File, Sent) ->
|
||||||
ok = file:close(File),
|
ok = file:close(File),
|
||||||
{sent, Sent};
|
{sent, Sent};
|
||||||
{ok, Bin} ->
|
{ok, Bin} ->
|
||||||
ok = Transport:send(Socket, Bin),
|
case Transport:send(Socket, Bin) of
|
||||||
sfallback(Transport, Socket, File, Sent + byte_size(Bin))
|
ok -> sfallback(Transport, Socket, File, Sent + byte_size(Bin));
|
||||||
|
{error, closed} -> {sent, Sent}
|
||||||
|
end
|
||||||
end.
|
end.
|
||||||
|
|
||||||
|
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue