From d0e655084850cc8a0d8148a0485352b1b58c643c Mon Sep 17 00:00:00 2001 From: Beats <61994374+beats-dh@users.noreply.github.com> Date: Thu, 19 Jan 2023 15:10:15 -0400 Subject: [PATCH] improve: upgrade curl to use TLS version 1.2 (#705) This change updates the version of curl used in the project to version 7.64.0 or above, which includes support for Transport Layer Security (TLS) version 1.2. This update ensures that the project is using the most secure version of the protocol and is in compliance with industry security standards. --- src/map/map.cpp | 2 +- src/server/network/webhook/webhook.cpp | 3 ++- 2 files changed, 3 insertions(+), 2 deletions(-) diff --git a/src/map/map.cpp b/src/map/map.cpp index f816d2ab20a..b320db9b4bf 100644 --- a/src/map/map.cpp +++ b/src/map/map.cpp @@ -47,8 +47,8 @@ bool Map::loadMap(const std::string& identifier, FILE *otbm = fopen(identifier.c_str(), "wb"); curl_easy_setopt(curl, CURLOPT_FOLLOWLOCATION, 1L); curl_easy_setopt(curl, CURLOPT_URL, mapDownloadUrl.c_str()); - curl_easy_setopt(curl, CURLOPT_WRITEDATA, otbm); curl_easy_setopt(curl, CURLOPT_SSLVERSION, CURL_SSLVERSION_TLSv1_2); + curl_easy_setopt(curl, CURLOPT_WRITEDATA, otbm); curl_easy_perform(curl); curl_easy_cleanup(curl); fclose(otbm); diff --git a/src/server/network/webhook/webhook.cpp b/src/server/network/webhook/webhook.cpp index 59544722998..27c756ab6c1 100644 --- a/src/server/network/webhook/webhook.cpp +++ b/src/server/network/webhook/webhook.cpp @@ -120,6 +120,7 @@ static int webhook_send_message_(const char *url, const char *payload, std::stri } curl_easy_setopt(curl, CURLOPT_URL, url); + curl_easy_setopt(curl, CURLOPT_SSLVERSION, CURL_SSLVERSION_TLSv1_2); curl_easy_setopt(curl, CURLOPT_POST, 1L); curl_easy_setopt(curl, CURLOPT_POSTFIELDS, payload); curl_easy_setopt(curl, CURLOPT_WRITEDATA, reinterpret_cast(&response_body)); @@ -133,7 +134,7 @@ static int webhook_send_message_(const char *url, const char *payload, std::stri curl_easy_getinfo(curl, CURLINFO_RESPONSE_CODE, &response_code); } else { SPDLOG_ERROR("Failed to send webhook message with the error: {}", - curl_easy_strerror(res)); + curl_easy_strerror(res)); } curl_easy_cleanup(curl);