From 6f8d122293401b06c4033e35db750a2eabe4fd8e Mon Sep 17 00:00:00 2001 From: Julian Oes Date: Thu, 12 Dec 2024 15:08:34 +1300 Subject: [PATCH] core: use http instead of https With v2 we don't have https support in cURL that we compile, so we have to try http instead of https. --- src/mavsdk/core/http_loader.cpp | 13 ++++++++++++- 1 file changed, 12 insertions(+), 1 deletion(-) diff --git a/src/mavsdk/core/http_loader.cpp b/src/mavsdk/core/http_loader.cpp index b47208db5..ed54f0a6c 100644 --- a/src/mavsdk/core/http_loader.cpp +++ b/src/mavsdk/core/http_loader.cpp @@ -1,5 +1,6 @@ #include "http_loader.h" #include "curl_wrapper.h" +#include "log.h" namespace mavsdk { @@ -86,7 +87,17 @@ bool HttpLoader::do_download( bool HttpLoader::download_text_sync(const std::string& url, std::string& content) { - bool success = _curl_wrapper->download_text(url, content); + std::string http_url(url); + + // We don't have https support in curl, so we try to use http for now. + + std::string https = "https"; + if (http_url.find(https, 0) == 0) { + http_url.replace(0, https.size(), "http"); + LogWarn() << "Downloading over http instead of https"; + } + + bool success = _curl_wrapper->download_text(http_url, content); return success; }