[Lazarus] TFPHttpClient: download progress (or status).

silvioprog silvioprog at gmail.com
Wed Jan 23 17:34:28 CET 2013


2013/1/23 silvioprog <silvioprog at gmail.com>

> Hello,
>
> First, sorry for my various requests. I'm contributing to improves this
> beautiful class.
>
> So, how to show a download progress?
>
> I think that the method "ReadResponse" should have two callbacks, like as
> "AContentLenght" and "AContentPosition". What do you think?
>
> Thank you!
>

Hm... If you change this internal funcion to a class method ...:

  Function Transfer(LB : Integer) : Integer;
  begin
    Result:=FSocket.Read(FBuffer[1],LB);
    If Result<0 then
      Raise EHTTPClient.Create(SErrReadingSocket);
    if (Result>0) then
      Stream.Write(FBuffer[1],Result);
  end;

... the progress of download will be possible, getting the currenty stream
size (or position?). :)

ps. i don't tested with chuncked content. :/

-- 
Silvio Cl├ęcio
My public projects - github.com/silvioprog
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.lazarus-ide.org/pipermail/lazarus/attachments/20130123/65bdf0c8/attachment-0003.html>


More information about the Lazarus mailing list