OpenTTD Source 20241224-master-gee860a5c8e
HTTPCallback Struct Referenceabstract

Callback for when the HTTP handler has something to tell us. More...

#include <http.h>

Inheritance diagram for HTTPCallback:
ClientNetworkContentSocketHandler NetworkSurveyHandler

Public Member Functions

virtual void OnFailure ()=0
 An error has occurred and the connection has been closed.
 
virtual void OnReceiveData (std::unique_ptr< char[]> data, size_t length)=0
 We're receiving data.
 
virtual bool IsCancelled () const =0
 Check if there is a request to cancel the transfer.
 
virtual ~HTTPCallback ()=default
 Silentium.
 

Detailed Description

Callback for when the HTTP handler has something to tell us.

Definition at line 20 of file http.h.

Member Function Documentation

◆ IsCancelled()

virtual bool HTTPCallback::IsCancelled ( ) const
pure virtual

Check if there is a request to cancel the transfer.

Returns
true iff the connection is cancelled.
Note
Cancellations are never instant, and can take a bit of time to be processed. The object needs to remain valid until the OnFailure() callback is called.

Implemented in ClientNetworkContentSocketHandler, and NetworkSurveyHandler.

Referenced by HTTPThreadSafeCallback::HandleQueue().

◆ OnFailure()

virtual void HTTPCallback::OnFailure ( )
pure virtual

An error has occurred and the connection has been closed.

Note
HTTP socket handler is closed/freed.

Implemented in ClientNetworkContentSocketHandler, and NetworkSurveyHandler.

Referenced by NetworkHTTPSocketHandler::Connect(), and HTTPThreadSafeCallback::HandleQueue().

◆ OnReceiveData()

virtual void HTTPCallback::OnReceiveData ( std::unique_ptr< char[]>  data,
size_t  length 
)
pure virtual

We're receiving data.

Parameters
datathe received data, nullptr when all data has been received.
lengththe amount of received data, 0 when all data has been received.
Note
When nullptr is sent the HTTP socket handler is closed/freed.

Implemented in ClientNetworkContentSocketHandler, and NetworkSurveyHandler.

Referenced by HTTPThreadSafeCallback::HandleQueue().


The documentation for this struct was generated from the following file: