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

silvioprog silvioprog at gmail.com
Wed Jan 23 18:17:54 CET 2013


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

> 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. :/
>

What do you think about implementa this method?:

(...)
public
    procedure ReadingResponse(const ASize, APosition: Int64); virtual;
(...)

Called internally by ReadResponse. (triggered by normal and chunked reading)

-- 
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/f098dc00/attachment-0003.html>


More information about the Lazarus mailing list