|
OpenTTD Source 20260311-master-g511d3794ce
|
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 () |
| Gets the last error from Windows as a string. | |
| static void | StaticWinHttpCallback (HINTERNET, DWORD_PTR context, DWORD code, void *info, DWORD length) |
| Implementation of Microsoft's WINHTTP_STATUS_CALLBACK. | |
| void | NetworkHTTPInitialize () |
| Initialize the HTTP socket handler. | |
| void | NetworkHTTPUninitialize () |
| Uninitialize the HTTP socket handler. | |
Variables | |
| static HINTERNET | _winhttp_session = nullptr |
| Currently running download session. | |
| static std::vector< NetworkHTTPRequest * > | _http_requests |
| HTTP requests that are currently running. | |
| static std::vector< NetworkHTTPRequest * > | _new_http_requests |
| HTTP requests that should be started. | |
| static std::mutex | _new_http_requests_mutex |
| Mutex to prevent concurrent access _new_http_requests. | |
| static std::vector< HTTPThreadSafeCallback * > | _http_callbacks |
| Callback for the current requests. | |
| static std::vector< HTTPThreadSafeCallback * > | _new_http_callbacks |
| Callbacks for the request that should be started. | |
| static std::mutex | _http_callback_mutex |
| Mutex to prevent concurrent access to _http_callbacks. | |
| static std::mutex | _new_http_callback_mutex |
| Mutex to prevent concurrent access to _new_http_callbacks. | |
WinHTTP-based implementation for HTTP requests.
Definition in file http_winhttp.cpp.
|
static |
Gets the last error from Windows as a string.
Definition at line 76 of file http_winhttp.cpp.
References FS2OTTD().
Referenced by NetworkHTTPRequest::Connect(), and NetworkHTTPRequest::WinHttpCallback().
| void NetworkHTTPInitialize | ( | ) |
Initialize the HTTP socket handler.
Definition at line 357 of file http_winhttp.cpp.
References _http_thread, _http_thread_exit, _winhttp_session, Debug, FileExists(), GetNetworkRevisionString(), HttpThread(), StartNewThread(), and StaticWinHttpCallback().
Referenced by NetworkStartUp().
| void NetworkHTTPUninitialize | ( | ) |
Uninitialize the HTTP socket handler.
Definition at line 370 of file http_winhttp.cpp.
References _http_cv, _http_mutex, _http_thread, _http_thread_exit, _winhttp_session, NetworkHTTPSocketHandler::HTTPReceive(), and lock.
Referenced by NetworkShutDown().
|
static |
Implementation of Microsoft's WINHTTP_STATUS_CALLBACK.
| context | Pointer to our context, i.e. our request. |
| code | The code of the event. |
| info | The information about the event. |
| length | The length of the information. |
Definition at line 207 of file http_winhttp.cpp.
References NetworkHTTPRequest::WinHttpCallback().
Referenced by NetworkHTTPInitialize().
|
static |
Mutex to prevent concurrent access to _http_callbacks.
Definition at line 53 of file http_winhttp.cpp.
Referenced by NetworkHTTPRequest::~NetworkHTTPRequest().
|
static |
Callback for the current requests.
Definition at line 51 of file http_winhttp.cpp.
Referenced by NetworkHTTPRequest::~NetworkHTTPRequest().
|
static |
HTTP requests that are currently running.
Definition at line 47 of file http_winhttp.cpp.
|
static |
Mutex to prevent concurrent access to _new_http_callbacks.
Definition at line 54 of file http_winhttp.cpp.
Referenced by NetworkHTTPRequest::NetworkHTTPRequest(), and NetworkHTTPRequest::NetworkHTTPRequest().
|
static |
Callbacks for the request that should be started.
Definition at line 52 of file http_winhttp.cpp.
Referenced by NetworkHTTPRequest::NetworkHTTPRequest(), and NetworkHTTPRequest::NetworkHTTPRequest().
|
static |
HTTP requests that should be started.
Definition at line 48 of file http_winhttp.cpp.
|
static |
Mutex to prevent concurrent access _new_http_requests.
Definition at line 49 of file http_winhttp.cpp.
|
static |
Currently running download session.
Definition at line 23 of file http_winhttp.cpp.
Referenced by NetworkHTTPRequest::Connect(), NetworkHTTPInitialize(), and NetworkHTTPUninitialize().