| 248 | } |
| 249 | |
| 250 | void 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 | |
| 285 | void NetworkHTTPUninitialize() |
| 286 | { |
nothing calls this directly
no test coverage detected