mirror of
https://github.com/processone/ejabberd.git
synced 2024-12-24 17:29:28 +01:00
SSL sockets don't compute length of data (EJABS-1460)
This commit is contained in:
parent
dcb068c7ad
commit
5ad1d08b89
@ -189,30 +189,38 @@ receive_headers(State) ->
|
||||
_ ->
|
||||
case Data of
|
||||
{ok, Binary} ->
|
||||
{Request, Trail} = parse_request(
|
||||
State,
|
||||
State#state.trail ++ binary_to_list(Binary)),
|
||||
State1 = State#state{trail = Trail},
|
||||
NewState = lists:foldl(
|
||||
fun(D, S) ->
|
||||
case S#state.end_of_request of
|
||||
true ->
|
||||
S;
|
||||
_ ->
|
||||
process_header(S, D)
|
||||
end
|
||||
end, State1, Request),
|
||||
case NewState#state.end_of_request of
|
||||
true ->
|
||||
ok;
|
||||
_ ->
|
||||
receive_headers(NewState)
|
||||
end;
|
||||
process_requests(State, binary_to_list(Binary));
|
||||
_ ->
|
||||
ok
|
||||
end
|
||||
end.
|
||||
|
||||
process_requests(State, Data) ->
|
||||
{Request, Trail} = parse_request(
|
||||
State,
|
||||
State#state.trail ++ Data),
|
||||
State1 = State#state{trail = Trail},
|
||||
NewState = lists:foldl(
|
||||
fun(D, S) ->
|
||||
case S#state.end_of_request of
|
||||
true ->
|
||||
S;
|
||||
_ ->
|
||||
process_header(S, D)
|
||||
end
|
||||
end, State1, Request),
|
||||
case State1#state.trail of
|
||||
[] ->
|
||||
case NewState#state.end_of_request of
|
||||
true ->
|
||||
ok;
|
||||
_ ->
|
||||
receive_headers(NewState)
|
||||
end;
|
||||
_ ->
|
||||
process_requests(State1, "")
|
||||
end.
|
||||
|
||||
process_header(State, Data) ->
|
||||
SockMod = State#state.sockmod,
|
||||
Socket = State#state.socket,
|
||||
@ -571,7 +579,11 @@ recv_data(_State, 0, Acc) ->
|
||||
recv_data(State, Len, Acc) ->
|
||||
case State#state.trail of
|
||||
[] ->
|
||||
case (State#state.sockmod):recv(State#state.socket, Len, 300000) of
|
||||
Len2 = case State#state.sockmod of
|
||||
gen_tcp -> Len;
|
||||
_ -> 0
|
||||
end,
|
||||
case (State#state.sockmod):recv(State#state.socket, Len2, 300000) of
|
||||
{ok, Data} ->
|
||||
recv_data(State, Len - size(Data), [Acc | Data]);
|
||||
_ ->
|
||||
|
Loading…
Reference in New Issue
Block a user