OpenTTD Source: NetworkHTTPContentConnecter Class Reference

OpenTTD Source 12.2

Public Member Functions | Private Attributes
NetworkHTTPContentConnecter Class Reference

Connect with a HTTP server and do ONE query. More...

`#include <tcp_http.h>`

Inheritance diagram for NetworkHTTPContentConnecter:

## Public Member Functions
| NetworkHTTPContentConnecter (const std::string &hostname, HTTPCallback *callback, const char *url, const char *data=nullptr, int depth=0)
| Start the connecting. More...
| ~NetworkHTTPContentConnecter ()
| Free all our allocated data.
void | OnFailure () override
| Callback for when the connection attempt failed.
void | OnConnect (SOCKET s) override
| Callback when the connection succeeded. More...

## Private Attributes
std::string | hostname
| Hostname we are connecting to.
HTTPCallback * | callback
| Callback to tell that we received some data (or won't).
const char * | url
| The URL we want to get at the server.
const char * | data
| The data to send.
int | depth
| How far we have recursed.

## Additional Inherited Members
Private Member Functions inherited from TCPConnecter
| TCPConnecter (const std::string &connection_string, uint16 default_port, NetworkAddress bind_address={}, int family=AF_UNSPEC)
| Create a new connecter for the given address. More...
void | Kill ()
| Kill this connecter. More...
Static Private Member Functions inherited from TCPConnecter
static void | CheckCallbacks ()
| Check whether we need to call the callback, i.e. More...
static void | KillAll ()
| Kill all connection attempts.

## Detailed Description

Connect with a HTTP server and do ONE query.

Definition at line 75 of file tcp_http.h.

## Constructor & Destructor Documentation

## ◆ NetworkHTTPContentConnecter()

NetworkHTTPContentConnecter::NetworkHTTPContentConnecter | ( | const std::string & | hostname,
|  | HTTPCallback * | callback,
|  | const char * | url,
|  | const char * | data = `nullptr`,
|  | int | depth = `0`
| ) |  |
| inline

Start the connecting.

Parameters

  hostname | The hostname to connect to.
  callback | The callback for HTTP retrieval.
  url | The url at the server.
  data | The data to send.
  depth | The depth (redirect recursion) of the queries.

Definition at line 91 of file tcp_http.h.

## Member Function Documentation

## ◆ OnConnect()

void NetworkHTTPContentConnecter::OnConnect | ( | SOCKET | s | ) |
| inlineoverridevirtual

Callback when the connection succeeded.

Parameters

  s | the socket that we opened

Reimplemented from TCPConnecter.

Definition at line 113 of file tcp_http.h.

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

- src/network/core/tcp_http.h