lnet HTTP request range lazarus / 38-Networking and Web Programming ---------------------------------------------------------------------- streeto · 2010-07-02 19:56 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. Code: [Select]  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; ---------------------------------------------------------------------- Almindor · 2010-07-03 13:24 I must admit this area of lNet is outside of my expertise (http was done by Micha Nelissen [neli]). I'll try to figure out if this is a bug or something is missing on your end. ---------------------------------------------------------------------- streeto · 2010-07-05 14:04 Just to add some context, and possibly help with the bug report, I attached a very simple example. ---------------------------------------------------------------------- streeto · 2010-07-08 22:04 Using Synapse it is possible to request a range of a document. One must work a way around the blocking methods, using threds perhaps. Here is a sample code: Code: [Select]  Response := TStringList.Create;   HTTP := THTTPSend.Create;   HTTP.RangeStart := 1;   HTTP.RangeEnd := 300;   try     Result := HTTP.HTTPMethod('GET', URL);     if Result then       Response.LoadFromStream(HTTP.Document);   finally     HTTP.Free;   end;