Hi. I searched a lot in this forum and have not found a post about this issue.
I am using lnet TLHTTPClientComponent to download a file. In some situations, I need to request only a part of the file. In HTTP this means adding "Range: bytes=start-end" to the header. TLHTTPClient has the properties RangeStart and RangeEnd, which according to the source add the proper header to the connection.
The thing is, this does not work. When these properties are set, I get a OnDisconnect event right after the request. Things work nicely otherwise. Is this the right way to make a ranged request?
Here is what I use to initialize the connection.
Client := TLHTTPClientComponent.Create(nil);
DecomposeURL(EditUrl.Text, Host, URI, Port);
Client.Host := Host;
Client.Port := Port;
Client.URI := URI;
Client.Method:= hmGet;
Client.Timeout := 10000;
Client.OnDisconnect := @ClientDisconnect;
Client.OnDoneInput := @ClientDoneInput;
Client.OnError := @ClientError;
Client.OnInput := @ClientInput;
Client.OnProcessHeaders := @ClientProcessHeaders;
Client.RangeStart := 10;
Client.RangeEnd := 100;
Client.SendRequest;