Sign in Join

Live chat for Free Pascal, Lazarus, Delphi and every Pascal programmer.

Mailing lists / fpc-devel / 2014-03

fpHttpClient heartbeat

5 messages · 2 people · –

Reply by email Subscribe to this list Your subscription

Read-only archive. Use j and k to move between messages.

Michael Van Canneyt
to Leonardo M. Ramé
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.

Reply by email

Leonardo M. Ramé
to Michael Van Canneyt

From: Michael Van Canneyt

Show quoted text 15 lines
To: FPC developers' list 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 ?.

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

Reply by email

Michael Van Canneyt
to Leonardo M. Ramé
Leonardo M. Ramé wrote 20 lines
From: Michael Van Canneyt > To: FPC developers' list > 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.

Reply by email

Leonardo M. Ramé
to Michael Van Canneyt
Show quoted text 62 lines
________________________________ From: Michael Van Canneyt To: Leonardo M. Ramé ; FPC developers' list 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 >> To: FPC developers' list >> 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

Reply by email