2

I have Delphi XE. I try to set Request.Range of idHttp but I cannot do this. Delphi doesn't allow me to do this neither at design time nor at run time.

E.g. I set '6000-' in a design time -> a property gets empty all time.

I do (in a thread):

Downloader.Request.Range:=(IntToStr(DFileStream.Position) + '-');
synchronize(procedure begin showmessage(Downloader.Request.Range) end); 

showmessage(Downloader.Request.Range) shows me nothing (an empty string).

I checked a request in HTTPAnalyzer -> my program doesn't send a range.

A checked this behavior in Delphi 2010 - all is normal. I set a range in a design/real time. A result is fine in the both cases.

Does anybody have ideas?

Is this a bug or what?

Thanks!

ain
  • 22,394
  • 3
  • 54
  • 74
maxfax
  • 4,281
  • 12
  • 74
  • 120

2 Answers2

5

The Range property is deprecated instead you must use the the Ranges property.

Check this sample

uses
  IdHTTPHeaderInfo; 

var
  Range: TIdEntityRange;
begin
    Range := FHttp.Request.Ranges.Add;
    Range.StartPos := FRangeFrom;
    Range.EndPos := FRangeTo;
    FHttp.Get(FURL, FileStream);
end;
RRUZ
  • 134,889
  • 20
  • 356
  • 483
  • @maxfax: Indy 10's documentation is very outdated. There have been a lot of features introduced and changes made since the documentation was last updated. – Remy Lebeau Aug 28 '11 at 22:20
1

Read this https://forums.embarcadero.com/thread.jspa?messageID=335670

How to set a range in Delphi XE:

idhttp1.Request.Ranges.Add.StartPos:=6000;

It's the same as

idHttp1.Request.Range:='6000-';
maxfax
  • 4,281
  • 12
  • 74
  • 120