MCPcopy Create free account
hub / github.com/OpenTTD/OpenTTD / NetworkHTTPInitialize

Function NetworkHTTPInitialize

src/network/core/http_winhttp.cpp:348–359  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

346}
347
348void NetworkHTTPInitialize()
349{
350 /* We create a single session, from which we build up every other request. */
351 std::string user_agent = fmt::format("OpenTTD/{}", GetNetworkRevisionString());
352 _winhttp_session = WinHttpOpen(std::wstring(user_agent.begin(), user_agent.end()).c_str(), WINHTTP_ACCESS_TYPE_DEFAULT_PROXY, WINHTTP_NO_PROXY_NAME, WINHTTP_NO_PROXY_BYPASS, WINHTTP_FLAG_ASYNC);
353
354 /* Set the callback function for all requests. The "context" maps it back into the actual request instance. */
355 WinHttpSetStatusCallback(_winhttp_session, StaticWinHttpCallback, WINHTTP_CALLBACK_FLAG_ALL_NOTIFICATIONS, 0);
356
357 /* 10 seconds timeout for requests. */
358 WinHttpSetTimeouts(_winhttp_session, 10000, 10000, 10000, 10000);
359}
360
361void NetworkHTTPUninitialize()
362{

Callers

nothing calls this directly

Calls 5

GetNetworkRevisionStringFunction · 0.85
formatFunction · 0.50
c_strMethod · 0.45
beginMethod · 0.45
endMethod · 0.45

Tested by

no test coverage detected