From: Chandru <cha...@us...> - 2006-11-13 20:41:55
|
Update of /cvsroot/jungerl/jungerl/lib/ibrowse/src In directory sc8-pr-cvs6.sourceforge.net:/tmp/cvs-serv28497/src Modified Files: ibrowse_http_client.erl Log Message: Release under BSD license. Fix for bug reported by Younes Hafri. See README for more details Index: ibrowse_http_client.erl =================================================================== RCS file: /cvsroot/jungerl/jungerl/lib/ibrowse/src/ibrowse_http_client.erl,v retrieving revision 1.7 retrieving revision 1.8 diff -u -d -r1.7 -r1.8 --- ibrowse_http_client.erl 12 Oct 2006 09:25:30 -0000 1.7 +++ ibrowse_http_client.erl 13 Nov 2006 20:41:36 -0000 1.8 @@ -410,13 +410,22 @@ %% of response. There maybe requests pipelined which need a response. handle_sock_closed(#state{reply_buffer=Buf, reqs=Reqs, http_status_code=SC, is_closing=IsClosing, cur_req=CurReq, + tmp_file_name=TmpFilename, tmp_file_fd=Fd, status=get_body, recvd_headers=Headers}=State) -> #request{from=From, stream_to=StreamTo, req_id=ReqId} = CurReq, case IsClosing of true -> {_, Reqs_1} = queue:out(Reqs), -% {{value, Req}, Reqs_1} = queue:out(Reqs), - do_reply(From, StreamTo, ReqId, {ok, SC, Headers, lists:flatten(lists:reverse(Buf))}), + case TmpFilename of + undefined -> + do_reply(From, StreamTo, ReqId, + {ok, SC, Headers, + lists:flatten(lists:reverse(Buf))}); + _ -> + file:close(Fd), + do_reply(From, StreamTo, ReqId, + {ok, SC, Headers, {file, TmpFilename}}) + end, do_error_reply(State#state{reqs = Reqs_1}, connection_closed); _ -> do_error_reply(State, connection_closed) @@ -858,9 +867,9 @@ send_timer=ReqTimer, recvd_headers = RespHeaders}=State) -> State_1 = set_cur_request(State), + file:close(Fd), do_reply(From, StreamTo, ReqId, {ok, SCode, RespHeaders, {file, TmpFilename}}), cancel_timer(ReqTimer, {eat_message, {req_timedout, From}}), - file:close(Fd), State_1#state{tmp_file_name=undefined, tmp_file_fd=undefined}; handle_response(#request{from=From, stream_to=StreamTo, req_id=ReqId}, #state{http_status_code=SCode, recvd_headers=RespHeaders, |