fix docker_http

This commit is contained in:
anlicheng 2026-04-23 15:47:21 +08:00
parent 801ff36d09
commit 4c3c584078

View File

@ -40,18 +40,18 @@ receive_response(ConnPid, StreamRef) ->
{error, timeout} {error, timeout}
end. end.
-spec receive_body(pid(), reference(), integer(), proplists:proplist(), binary()) -> -spec receive_body(pid(), reference(), integer(), proplists:proplist(), binary()) ->
{ok, integer(), proplists:proplist(), binary()} | {error, timeout22}. {ok, integer(), proplists:proplist(), binary()} | {error, timeout}.
receive_body(ConnPid, StreamRef, Status, Headers, Acc) -> receive_body(ConnPid, StreamRef, Status, Headers, Acc) ->
receive receive
{gun_data, ConnPid, StreamRef, fin, Data} -> {gun_data, ConnPid, StreamRef, fin, Data} ->
{ok, Status, Headers, <<Acc/binary, Data/binary>>}; Body = iolist_to_binary([Acc, Data]),
{ok, Status, Headers, Body};
{gun_data, ConnPid, StreamRef, nofin, Data} -> {gun_data, ConnPid, StreamRef, nofin, Data} ->
NewAcc = <<Acc/binary, Data/binary>>, receive_body(ConnPid, StreamRef, Status, Headers, [Acc, Data]);
receive_body(ConnPid, StreamRef, Status, Headers, NewAcc);
{gun_down, ConnPid, _, Reason, _} -> {gun_down, ConnPid, _, Reason, _} ->
{error, {http_closed, Reason}} {error, {http_closed, Reason}}
after 10000 -> after 10000 ->
{error, timeout22} {error, timeout}
end. end.
%% Unix Socket Docker API %% Unix Socket Docker API