From ab5ac287b87f68a869184d89eca7ffaa63d64377 Mon Sep 17 00:00:00 2001 From: Filipe David Manana Date: Wed, 5 Jan 2011 16:13:21 +0000 Subject: [PATCH] Fix worker process hanging when it received partial headers and the caller controls the socket --- src/ibrowse_http_client.erl | 12 ++++++++---- 1 file changed, 8 insertions(+), 4 deletions(-) diff --git a/src/ibrowse_http_client.erl b/src/ibrowse_http_client.erl index ea75948..2d41c91 100644 --- a/src/ibrowse_http_client.erl +++ b/src/ibrowse_http_client.erl @@ -287,10 +287,14 @@ handle_sock_data(Data, #state{status = get_header}=State) -> {error, _Reason} -> shutting_down(State), {stop, normal, State}; - State_1 -> - active_once(State_1), - State_2 = set_inac_timer(State_1), - {noreply, State_2} + #state{socket = Socket, status = Status, cur_req = CurReq} = State_1 -> + case {Status, CurReq} of + {get_header, #request{caller_controls_socket = true}} -> + do_setopts(Socket, [{active, once}], State_1); + _ -> + active_once(State_1) + end, + {noreply, set_inac_timer(State_1)} end; handle_sock_data(Data, #state{status = get_body,