Public Member Functions | List of all members
BUrlProtocolListener Class Reference

Abstract interface for handling BUrlRequest events. More...

Inherited by BUrlProtocolAsynchronousListener, BUrlProtocolDispatchingListener, and BUrlSynchronousRequest.

Public Member Functions

virtual bool CertificateVerificationFailed (BUrlRequest *caller, BCertificate &certificate, const char *message)
 Called when cerificate verification failed. More...
 
virtual void ConnectionOpened (BUrlRequest *caller)
 Called when the socket is opened. More...
 
virtual void DataReceived (BUrlRequest *caller, const char *data, off_t position, ssize_t size)
 Called each time a block of data is received. More...
 
virtual void DebugMessage (BUrlRequest *caller, BUrlProtocolDebugMessage type, const char *text)
 Called each time a debug message is emitted. More...
 
virtual void DownloadProgress (BUrlRequest *caller, ssize_t bytesReceived, ssize_t bytesTotal)
 Called each time a block of data is downloaded. More...
 
virtual void HeadersReceived (BUrlRequest *caller, const BUrlResult &result)
 Called when all of the server response metadata (such as headers) have been read and parsed. More...
 
virtual void HostnameResolved (BUrlRequest *caller, const char *ip)
 Called when the final IP is discovered. More...
 
virtual void RequestCompleted (BUrlRequest *caller, bool success)
 Called once the request is complete. More...
 
virtual void ResponseStarted (BUrlRequest *caller)
 Called when the request has been emitted and the server begins to reply. More...
 
virtual void UploadProgress (BUrlRequest *caller, ssize_t bytesSent, ssize_t bytesTotal)
 Called each time a block of data is sent. More...
 

Detailed Description

Abstract interface for handling BUrlRequest events.

BUrlProtocolListener is the base class for handling networking events from BUrlRequest.

Member Function Documentation

◆ CertificateVerificationFailed()

bool BUrlProtocolListener::CertificateVerificationFailed ( BUrlRequest *  caller,
BCertificate &  certificate,
const char *  message 
)
virtual

Called when cerificate verification failed.

Frequency: Once

Parameters
callerThe BUrlRequest that invoked this callback.
certificateThe SSL certificate of which validation failed.
messageThe error message describing the issue.
Returns
true to ignore and proceed with the request, false to abort.

◆ ConnectionOpened()

void BUrlProtocolListener::ConnectionOpened ( BUrlRequest *  caller)
virtual

Called when the socket is opened.

Frequency: Once

Parameters
callerThe BUrlRequest that invoked this callback.

◆ DataReceived()

void BUrlProtocolListener::DataReceived ( BUrlRequest *  caller,
const char *  data,
off_t  position,
ssize_t  size 
)
virtual

Called each time a block of data is received.

Frequency: Zero or more

Parameters
callerThe BUrlRequest that invoked this callback.
dataPointer to the data block in memory.
positionOffset of the data in the stream.
sizeSize of the data block.

◆ DebugMessage()

void BUrlProtocolListener::DebugMessage ( BUrlRequest *  caller,
BUrlProtocolDebugMessage  type,
const char *  text 
)
virtual

Called each time a debug message is emitted.

Frequency: Zero or more

Parameters
callerThe BUrlRequest that invoked this callback.
typeType of the message.
textThe message.

◆ DownloadProgress()

void BUrlProtocolListener::DownloadProgress ( BUrlRequest *  caller,
ssize_t  bytesReceived,
ssize_t  bytesTotal 
)
virtual

Called each time a block of data is downloaded.

This callback will usually be called after DataReceived().

Frequency: Once or more

Parameters
callerThe BUrlRequest that invoked this callback.
bytesReceivedNumber of data bytes received. This is the number of bytes received prior to any processing and can be smaller than the size of the data block sent to DataReceived() as the transport might be compressed.
bytesTotalTotal number of data bytes expected. 0 will be passed if the total number of data bytes is not available.

◆ HeadersReceived()

void BUrlProtocolListener::HeadersReceived ( BUrlRequest *  caller,
const BUrlResult &  result 
)
virtual

Called when all of the server response metadata (such as headers) have been read and parsed.

Frequency: Once

Parameters
callerThe BUrlRequest that invoked this callback.
resultThe BUrlResult associated with the request.

◆ HostnameResolved()

void BUrlProtocolListener::HostnameResolved ( BUrlRequest *  caller,
const char *  ip 
)
virtual

Called when the final IP is discovered.

Frequency: Once

Parameters
callerThe BUrlRequest that invoked this callback.
ipString representing the IP address of the resource host.

◆ RequestCompleted()

void BUrlProtocolListener::RequestCompleted ( BUrlRequest *  caller,
bool  success 
)
virtual

Called once the request is complete.

Frequency: Once

Parameters
callerThe BUrlRequest that invoked this callback.
successWhether the request has been successfully completed.

◆ ResponseStarted()

void BUrlProtocolListener::ResponseStarted ( BUrlRequest *  caller)
virtual

Called when the request has been emitted and the server begins to reply.

Typically this callback will be called when the HTTP status code is received.

Frequency: Once

Parameters
callerThe BUrlRequest that invoked this callback.

◆ UploadProgress()

void BUrlProtocolListener::UploadProgress ( BUrlRequest *  caller,
ssize_t  bytesSent,
ssize_t  bytesTotal 
)
virtual

Called each time a block of data is sent.

Note
Currently this callback is never called.
Parameters
callerThe BUrlRequest that invoked this callback.
bytesSentNumber of data bytes sent.
bytesTotalTotal number of data bytes left.