[fpc-devel] fpHttpClient heartbeat

Leonardo M. Ramé martinrame at yahoo.com
Wed Mar 12 20:47:34 CET 2014


>________________________________
> From: Michael Van Canneyt <michael at freepascal.org>
>To: Leonardo M. Ramé <martinrame at yahoo.com>; FPC developers' list <fpc-devel at lists.freepascal.org> 
>Sent: Sunday, March 9, 2014 6:22 AM
>Subject: Re: [fpc-devel] fpHttpClient heartbeat
> 
>
>
>
>On Sat, 8 Mar 2014, Leonardo M. Ramé wrote:
>
>>
>>
>> From: Michael Van Canneyt <michael at freepascal.org>
>>> To: FPC developers' list <fpc-devel at lists.freepascal.org>
>>> Sent: Saturday, March 8, 2014 2:42 PM
>>> Subject: Re: [fpc-devel] fpHttpClient heartbeat
>>>
>>>
>>> On Sat, 8 Mar 2014, Leonardo M. Ramé wrote:
>>>
>>>> Hi, does anyone know if fpHttpClient has something similar to the HeartBeat option of Synapse?, this feature is useful for
>>>> implementing download progress bars, for example.
>>>
>>> It has an onprogress event, this is implemented in trunk.
>>>
>>> Michael.
>>>
>>>
>>
>> Sorry Michael, I cannot find that event, is in packages/fcl-web/src/base/fphttpclient.pp ?.
>
>My apologies, I wrote from memory.
>
>Less than a month ago I implemented:
>
>     Property AllowRedirect : Boolean Read FAllowRedirect Write FAllowRedirect;
>     // Maximum number of redirects. When this number is reached, an exception is raised.
>     Property MaxRedirects : Byte Read FMaxRedirects Write FMaxRedirects default DefMaxRedirects;
>     // Called On redirect. Dest URL can be edited.
>     // If The DEST url is empty on return, the method is aborted (with redirect status).
>     Property OnRedirect : TRedirectEvent Read FOnRedirect Write FOnRedirect;
>     // Authentication.
>     // When set, they override the credentials found in the URI.
>     // They also override any Authenticate: header in Requestheaders.
>     Property UserName : String Read FUserName Write FUserName;
>     Property Password : String Read FPassword Write FPassword;
>     // If a request returns a 401, then the OnPassword event is fired.
>     // It can modify the username/password and set RepeatRequest to true;
>     Property OnPassword : TPasswordEvent Read FOnPassword Write FOnPassword;
>     // Called whenever data is read from the connection.
>     Property OnDataReceived : TDataEvent Read FOnDataReceived Write FOnDataReceived;
>     // Called when headers have been processed.
>     Property OnHeaders : TNotifyEvent Read FOnHeaders Write FOnHeaders;
>
>
>OnDataReceived and OnHeaders is probably what you are looking for. Sorry for the fuzzyness.
>
>
>Michael.
>
> 
Hi Michael, I noted you created the httpget.pas demo on fcl-web/examples/httpclient, that's exactly what I'm looking for.

One little addition to the example can be exception handling, I noted there's an EHTTPClient exception raised when an error response is received (404, 500, etc).


Leonardo M. Ramé
http://leonardorame.blogspot.com




More information about the fpc-devel mailing list