| 346 | } |
| 347 | |
| 348 | void 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 | |
| 361 | void NetworkHTTPUninitialize() |
| 362 | { |
nothing calls this directly
no test coverage detected