25
1
mirror of https://github.com/processone/ejabberd.git synced 2024-11-22 16:20:52 +01:00

Handle binary data from SockMod:recv in ejabberd_http:recv_data/3 (thanks to Andreas Köhler)(EJAB-1331)

This commit is contained in:
Badlop 2010-10-27 21:20:48 +02:00
parent 70c247d357
commit 231d44ffa3

View File

@ -473,14 +473,17 @@ recv_data(State, Len, Acc) ->
case State#state.trail of
[] ->
case (State#state.sockmod):recv(State#state.socket, Len, 300000) of
{ok, Binary} when is_binary(Binary) ->
Data = binary_to_list(Binary),
recv_data(State, Len - length(Data), Acc ++ Data);
{ok, Data} ->
recv_data(State, Len - length(Data), [Acc | Data]);
recv_data(State, Len - length(Data), Acc ++ Data);
_ ->
""
end;
_ ->
Trail = State#state.trail,
recv_data(State#state{trail = ""}, Len - length(Trail), [Acc | Trail])
recv_data(State#state{trail = ""}, Len - length(Trail), Acc ++ Trail)
end.