Download file with TidHTTP works with xml but not sql extension

Giganews Newsgroups
Subject: Download file with TidHTTP works with xml but not sql extension
Posted by:  Bill N (bniels…@cpumanagement.com)
Date: Thu, 22 Jul 2004

I'm trying to download some files via http.  I used the following code
to download a file.
====================================================================
procedure TMainForm.DownloadFile(SourceURL:string; const Destination:
string);
Var
  Stream : TFileStream;
Begin
  Try
    Stream := TFileStream.Create(Destination, fmCreate);
    try
      IdHTTP.Get(SourceURL, Stream);
    Except
      FDownloadResult := False;
      raise;
    End;
  finally
    Stream.Free;
  end;
end;
======================================================================
The code above correctly downloaded a xml file but when I tried to
download a sql script (*.sql) I got a 400 bad request error.  How do I
download other files besides html and xml?

Thanks,
Bill N

Replies