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