OpenTTD Source: HTTPCallback Struct Reference

OpenTTD Source 15.0-beta1

Public Member Functions
HTTPCallback Struct Referenceabstract

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

`#include <http.h>`

Inheritance diagram for HTTPCallback:

## 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

  data | the received data, nullptr when all data has been received.
  length | the 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:

- src/network/core/http.h