Infinite loop in TidHTTP.Post method

Hi All. Help me, please!

I use Delphi 4, Indy 8.0.22 and Oracle Application Server 4.0.8.2.1

I develop NT Service application, and I make http request (frequency - 5
sec) in OnExecute event handler.

Sometimes (1 time in 2 days), my service is stops.

When my service is stops, function MyDeb writes in the file the following
parameters of http request:
tURL="http://roadwww:8889/POST"
Req="type_req=PUT&kod_soob=2000&vid_soob=2&sender=61.00.9900&receiver=61.05.
0004&type_obr=1&kolvo_e
x=1&message=(%3A0497+%C2%D6+%CF%D0%C8%C2+9624008+11+10+16+05+001%3A%0D%0A%DE
1+0000+0201+001+000+6448%2B097%2B6110%3A)"

This is text of the used function:

----------------------------------------------------------------------------
-----------------------------------------------
function MakeHTTPRequestPOST(Host: String; Port: Integer; ShortURL: String;
         Header, Content: TStrings; NameStrPar, ValStrPar: String;
         Method: HTTPMethod; var Response: String; RespHeader: TStrings):
Integer;
var
  HTTP: TIdHTTP;
  AntiFreeze: TIdAntiFreeze;
  Req: TStringStream;
  Resp: TStringStream;
  i: Integer;
  tReq: String;
begin
  AntiFreeze:=TIdAntiFreeze.Create(Application);
  try
    AntiFreeze.OnlyWhenIdle:=False;
    AntiFreeze.Active:=True;
    AntiFreeze.IdleTimeOut:=181;
    HTTP:=TIdHTTP.Create(Application);
    try
      try
        Result:=-1;
        HTTP.Host:=Host;
        HTTP.Port:=Port;
        if Header<> nil then
          for i:=0 to Header.Count-1 do

HTTP.Request.ExtraHeaders.Add(HttpEncode(Header.Names[i])+':'+HttpEncode(Hea
der.Values[Header.Names[i]]));

        Resp := TStringStream.Create('');
        Req := TStringStream.Create('');
        tReq:='';
        try
          if Content<>nil then
            for i:=0 to Content.Count-1 do begin

tReq:=tReq+HttpEncode(Content.Names[i])+'='+HttpEnCode(Content.Values[Conten
t.Names[i]]);
              if i<>(Content.Count-1) then tReq:=tReq+'&';
            end;
          if (NameStrPar<>'') and (ValStrPar<>'') then begin
            if tReq<>'' then tReq:=tReq+'&';
            tReq:=tReq+HttpEncode(NameStrPar)+'='+HttpEncode(ValStrPar);
          end;
          Req.WriteString(tReq);
MyDeb('Par:'+#13#10
      +'tURL="'+tURL+'"'+#13#10
      +'Req="'+Req.DataString+'"'+#13#10
////////////////////////////////////////////////////////////////////////////
////
          { Programs enters an infinite loop in new row }
          HTTP.Post('http://'+Host+':'+IntToStr(Port)+ShortURL, Req, Resp);
////////////////////////////////////////////////////////////////////////////
////
          Response:=Resp.DataString;
          if RespHeader<>nil then
            for i:=0 to HTTP.Response.ExtraHeaders.Count-1 do
              RespHeader.Add(HTTP.Response.ExtraHeaders.Names[i]+'='+

HTTP.Response.ExtraHeaders.Values[HTTP.Response.ExtraHeaders.Names[i]]);
          Result:=0;
        finally
          Req.Free;
          Resp.Free;
        end;
      finally
        HTTP.Free;
      end;
    except
      Result:=-1;
    end;
  finally
    AntiFreeze.Free;
  end;
end;

----------------------------------------------------------------------------
-----------------------------------------------

Help me, please!

--
Serge Isaev
Oracle Applicaton Server Administrator and Developer
"Transsystemotechnika"
sis...@mail.ru trans...@msk.tsi.ru