25
1
mirror of https://github.com/processone/ejabberd.git synced 2024-11-26 16:26:24 +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.trail of
[] -> [] ->
case (State#state.sockmod):recv(State#state.socket, Len, 300000) 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} -> {ok, Data} ->
recv_data(State, Len - length(Data), [Acc | Data]); recv_data(State, Len - length(Data), Acc ++ Data);
_ -> _ ->
"" ""
end; end;
_ -> _ ->
Trail = State#state.trail, 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. end.