fix docker_http
This commit is contained in:
parent
801ff36d09
commit
4c3c584078
@ -40,18 +40,18 @@ receive_response(ConnPid, StreamRef) ->
|
||||
{error, timeout}
|
||||
end.
|
||||
-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
|
||||
{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} ->
|
||||
NewAcc = <<Acc/binary, Data/binary>>,
|
||||
receive_body(ConnPid, StreamRef, Status, Headers, NewAcc);
|
||||
receive_body(ConnPid, StreamRef, Status, Headers, [Acc, Data]);
|
||||
{gun_down, ConnPid, _, Reason, _} ->
|
||||
{error, {http_closed, Reason}}
|
||||
after 10000 ->
|
||||
{error, timeout22}
|
||||
{error, timeout}
|
||||
end.
|
||||
|
||||
%% 通过 Unix Socket 调用 Docker API
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user