|
@ -357,7 +357,8 @@ accumulate_response(Data, |
|
|
tmp_file_fd = undefined} = CurReq, |
|
|
tmp_file_fd = undefined} = CurReq, |
|
|
http_status_code=[$2 | _]}=State) when Srtf /= false -> |
|
|
http_status_code=[$2 | _]}=State) when Srtf /= false -> |
|
|
TmpFilename = make_tmp_filename(Srtf), |
|
|
TmpFilename = make_tmp_filename(Srtf), |
|
|
case file:open(TmpFilename, [write, delayed_write, raw]) of |
|
|
|
|
|
|
|
|
Mode = file_mode(Srtf), |
|
|
|
|
|
case file:open(TmpFilename, [Mode, delayed_write, raw]) of |
|
|
{ok, Fd} -> |
|
|
{ok, Fd} -> |
|
|
accumulate_response(Data, State#state{ |
|
|
accumulate_response(Data, State#state{ |
|
|
cur_req = CurReq#request{ |
|
|
cur_req = CurReq#request{ |
|
@ -434,8 +435,13 @@ make_tmp_filename(true) -> |
|
|
integer_to_list(B) ++ |
|
|
integer_to_list(B) ++ |
|
|
integer_to_list(C)]); |
|
|
integer_to_list(C)]); |
|
|
make_tmp_filename(File) when is_list(File) -> |
|
|
make_tmp_filename(File) when is_list(File) -> |
|
|
|
|
|
File; |
|
|
|
|
|
make_tmp_filename({append, File}) when is_list(File) -> |
|
|
File. |
|
|
File. |
|
|
|
|
|
|
|
|
|
|
|
file_mode({append, _File}) -> append; |
|
|
|
|
|
file_mode(_Srtf) -> write. |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
%%-------------------------------------------------------------------- |
|
|
%%-------------------------------------------------------------------- |
|
|
%% Handles the case when the server closes the socket |
|
|
%% Handles the case when the server closes the socket |
|
|