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

Function NetworkHTTPInitialize

src/network/core/http_curl.cpp:250–283  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

248}
249
250void NetworkHTTPInitialize()
251{
252 curl_global_init(CURL_GLOBAL_DEFAULT);
253
254#if defined(UNIX)
255 /* Depending on the Linux distro, certificates can either be in
256 * a bundle or a folder, in a wide range of different locations.
257 * Try to find what location is used by this OS. */
258 for (auto &ca_file : _certificate_files) {
259 if (FileExists(ca_file)) {
260 _http_ca_file = ca_file;
261 break;
262 }
263 }
264 if (_http_ca_file.empty()) {
265 for (auto &ca_path : _certificate_directories) {
266 if (FileExists(ca_path)) {
267 _http_ca_path = ca_path;
268 break;
269 }
270 }
271 }
272 Debug(net, 3, "Using certificate file: {}", _http_ca_file.empty() ? "none" : _http_ca_file);
273 Debug(net, 3, "Using certificate path: {}", _http_ca_path.empty() ? "none" : _http_ca_path);
274
275 /* Tell the user why HTTPS will not be working. */
276 if (_http_ca_file.empty() && _http_ca_path.empty()) {
277 Debug(net, 0, "No certificate files or directories found, HTTPS will not work!");
278 }
279#endif /* UNIX */
280
281 _http_thread_exit = false;
282 StartNewThread(&_http_thread, "ottd:http", &HttpThread);
283}
284
285void NetworkHTTPUninitialize()
286{

Callers

nothing calls this directly

Calls 3

FileExistsFunction · 0.85
StartNewThreadFunction · 0.85
emptyMethod · 0.45

Tested by

no test coverage detected