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

OpenTTD Source 15.0-beta1

Data Structures | Functions | Variables
http_winhttp.cpp File Reference

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

`#include "../../stdafx.h"`
`#include "../../debug.h"`
`#include "../../rev.h"`
`#include "../network_internal.h"`
`#include "http.h"`
`#include "http_shared.h"`
`#include <mutex>`
`#include <winhttp.h>`
`#include "../../safeguards.h"`

Go to the source code of this file.

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

## Functions
static std::string | GetLastErrorAsString ()
static void CALLBACK | StaticWinHttpCallback (HINTERNET, DWORD_PTR context, DWORD code, void *info, DWORD length)
void | NetworkHTTPInitialize ()
| Initialize the HTTP socket handler.
void | NetworkHTTPUninitialize ()
| Uninitialize the HTTP socket handler.

## Variables
static HINTERNET | _winhttp_session = nullptr
static std::vector< NetworkHTTPRequest * > | _http_requests
static std::vector< NetworkHTTPRequest * > | _new_http_requests
static std::mutex | _new_http_requests_mutex
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

## Detailed Description

WinHTTP-based implementation for HTTP requests.

Definition in file http_winhttp.cpp.

## Function Documentation

## ◆ GetLastErrorAsString()

static std::string GetLastErrorAsString | ( |  | ) |
| static

Definition at line 74 of file http_winhttp.cpp.

## ◆ NetworkHTTPInitialize()

void NetworkHTTPInitialize | ( |  | ) |

Initialize the HTTP socket handler.

Definition at line 348 of file http_winhttp.cpp.

References Debug, FileExists(), and StartNewThread().

Referenced by NetworkStartUp().

## ◆ NetworkHTTPUninitialize()

void NetworkHTTPUninitialize | ( |  | ) |

Uninitialize the HTTP socket handler.

Definition at line 361 of file http_winhttp.cpp.

References NetworkHTTPSocketHandler::HTTPReceive(), and lock.

Referenced by NetworkShutDown().

## ◆ StaticWinHttpCallback()

static void CALLBACK StaticWinHttpCallback | ( | HINTERNET | ,
|  | DWORD_PTR | context,
|  | DWORD | code,
|  | void * | info,
|  | DWORD | length
| ) |  |
| static

Definition at line 198 of file http_winhttp.cpp.

## Variable Documentation

## ◆ _http_callback_mutex

std::mutex _http_callback_mutex
| static

Definition at line 55 of file http_winhttp.cpp.

## ◆ _http_callbacks

std::vector<HTTPThreadSafeCallback *> _http_callbacks
| static

Definition at line 53 of file http_winhttp.cpp.

## ◆ _http_requests

std::vector<NetworkHTTPRequest *> _http_requests
| static

Definition at line 49 of file http_winhttp.cpp.

## ◆ _new_http_callback_mutex

std::mutex _new_http_callback_mutex
| static

Definition at line 56 of file http_winhttp.cpp.

## ◆ _new_http_callbacks

std::vector<HTTPThreadSafeCallback *> _new_http_callbacks
| static

Definition at line 54 of file http_winhttp.cpp.

## ◆ _new_http_requests

std::vector<NetworkHTTPRequest *> _new_http_requests
| static

Definition at line 50 of file http_winhttp.cpp.

## ◆ _new_http_requests_mutex

std::mutex _new_http_requests_mutex
| static

Definition at line 51 of file http_winhttp.cpp.

## ◆ _winhttp_session

HINTERNET _winhttp_session = nullptr
| static

Definition at line 25 of file http_winhttp.cpp.