0
Fork 0
mirror of https://github.com/ninenines/cowboy.git synced 2025-07-16 05:00:24 +00:00

Fix multipart parser when the boundary is not fully read yet

This commit is contained in:
Thomas Nordström 2012-12-14 15:43:22 +01:00
parent d761a34380
commit 143ed80486

View file

@ -204,8 +204,8 @@ parse_body(Bin, Pattern = {{P, PSize}, _}) when byte_size(Bin) >= PSize ->
%% next input onto tail of current input binary.
{body, Bin, fun () -> parse_body(<<>>, Pattern) end};
{BoundaryStart, Len} ->
PBody = binary:part(Bin, BoundaryStart, Len),
Rest = binary:part(Bin, 0, BoundaryStart),
PBody = binary:part(Bin, 0, BoundaryStart),
Rest = binary:part(Bin, BoundaryStart, Len),
{body, PBody, fun () -> parse_body(Rest, Pattern) end}
end
end;