OpenTTD Source 20260311-master-g511d3794ce
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
 Ensure the destructor of the sub classes are called as well.

Detailed Description

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

Definition at line 18 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.

◆ 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().

◆ 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.


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