Resumeable downloads with TidHttp component

Giganews Newsgroups
Subject: Resumeable downloads with TidHttp component
Posted by:  Gerry O'Connell (goco…@iol.ie)
Date: Thu, 4 May 2006

Hi Folks,

I am trying to use TidHttp component to perform partial file downloads, for
example, resuming a large file download after the connection has been
dropped, or the user disconnects from the network.

Using D2005 (with Update 3), Indy 10.0.20, the following code will work.
That is, the component will download partial files which can be assembled at
the client.
Note:
    FileGetSize is in JclFileUtils.PAS

Var
    IdHttp : TidHttp;
    FileName : String;
    FileStream : TFileStream;

begin
..
    IdHttp := TidHttp.Create;
    IdHttp.Request.ContentRangeStart := FileGetSize(FileName);
    IdHttp.Get(Url,FileStream);
end;

However, using D2006 (with Update 2), Indy 10.1.5 the code fails. That is, I
always receive a HTTP/1.1 200 OK reply from the server indicating that it is
downloading the entire file each time.

Any help with this would be appreciated.

Cheers,
Gerry O'Connell,
Screendragon International.

Replies