OpenTTD Source: src/network/core/http_curl.cpp File Reference

OpenTTD Source 15.0-RC2

Data Structures | Functions | Variables
http_curl.cpp File Reference

CURL-based implementation for HTTP requests. More...

`#include "../../stdafx.h"`
`#include "../../debug.h"`
`#include "../../fileio_func.h"`
`#include "../../rev.h"`
`#include "../../thread.h"`
`#include "../network_internal.h"`
`#include "http.h"`
`#include "http_shared.h"`
`#include <atomic>`
`#include <condition_variable>`
`#include <curl/curl.h>`
`#include <mutex>`
`#include <queue>`
`#include "../../safeguards.h"`

Go to the source code of this file.

## Data Structures
class | NetworkHTTPRequest
| Single HTTP request. More...

## Functions
void | CurlSetOption (CURL *curl, auto option, auto value)
void | HttpThread ()
void | NetworkHTTPInitialize ()
| Initialize the HTTP socket handler.
void | NetworkHTTPUninitialize ()
| Uninitialize the HTTP socket handler.

## Variables
static std::vector< HTTPThreadSafeCallback * > | _http_callbacks
static std::vector< HTTPThreadSafeCallback * > | _new_http_callbacks
static std::mutex | _http_callback_mutex
static std::mutex | _new_http_callback_mutex
static std::thread | _http_thread
static std::atomic< bool > | _http_thread_exit = false
static std::queue< std::unique_ptr< NetworkHTTPRequest > > | _http_requests
static std::mutex | _http_mutex
static std::condition_variable | _http_cv

## Detailed Description

CURL-based implementation for HTTP requests.

Definition in file http_curl.cpp.

## Function Documentation

## ◆ CurlSetOption()

void CurlSetOption | ( | CURL * | curl,
|  | auto | option,
|  | auto | value
| ) |  |

Definition at line 125 of file http_curl.cpp.

## ◆ HttpThread()

void HttpThread | ( |  | ) |

Definition at line 133 of file http_curl.cpp.

## ◆ NetworkHTTPInitialize()

void NetworkHTTPInitialize | ( |  | ) |

Initialize the HTTP socket handler.

Definition at line 250 of file http_curl.cpp.

## ◆ NetworkHTTPUninitialize()

void NetworkHTTPUninitialize | ( |  | ) |

Uninitialize the HTTP socket handler.

Definition at line 285 of file http_curl.cpp.

## Variable Documentation

## ◆ _http_callback_mutex

std::mutex _http_callback_mutex
| static

Definition at line 50 of file http_curl.cpp.

## ◆ _http_callbacks

std::vector<HTTPThreadSafeCallback *> _http_callbacks
| static

Definition at line 48 of file http_curl.cpp.

## ◆ _http_cv

std::condition_variable _http_cv
| static

Definition at line 87 of file http_curl.cpp.

## ◆ _http_mutex

std::mutex _http_mutex
| static

Definition at line 86 of file http_curl.cpp.

## ◆ _http_requests

std::queue<std::unique_ptr<NetworkHTTPRequest> > _http_requests
| static

Definition at line 85 of file http_curl.cpp.

## ◆ _http_thread

std::thread _http_thread
| static

Definition at line 83 of file http_curl.cpp.

## ◆ _http_thread_exit

std::atomic<bool> _http_thread_exit = false
| static

Definition at line 84 of file http_curl.cpp.

## ◆ _new_http_callback_mutex

std::mutex _new_http_callback_mutex
| static

Definition at line 51 of file http_curl.cpp.

## ◆ _new_http_callbacks

std::vector<HTTPThreadSafeCallback *> _new_http_callbacks
| static

Definition at line 49 of file http_curl.cpp.