diff --git a/src/mavsdk/core/curl_wrapper.cpp b/src/mavsdk/core/curl_wrapper.cpp index 30ef52aa9..827e21903 100644 --- a/src/mavsdk/core/curl_wrapper.cpp +++ b/src/mavsdk/core/curl_wrapper.cpp @@ -29,6 +29,8 @@ bool CurlWrapper::download_text(const std::string& url, std::string& content) curl_easy_setopt(curl.get(), CURLOPT_URL, url.c_str()); curl_easy_setopt(curl.get(), CURLOPT_WRITEFUNCTION, write_callback); curl_easy_setopt(curl.get(), CURLOPT_WRITEDATA, &readBuffer); + curl_easy_setopt(curl.get(), CURLOPT_SSL_VERIFYPEER, 1L); + curl_easy_setopt(curl.get(), CURLOPT_FOLLOWLOCATION, 1L); res = curl_easy_perform(curl.get()); content = readBuffer; @@ -108,6 +110,8 @@ bool CurlWrapper::download_file_to_path( curl_easy_setopt(curl.get(), CURLOPT_WRITEFUNCTION, NULL); curl_easy_setopt(curl.get(), CURLOPT_WRITEDATA, fp); curl_easy_setopt(curl.get(), CURLOPT_NOPROGRESS, 0L); + curl_easy_setopt(curl.get(), CURLOPT_SSL_VERIFYPEER, 1L); + curl_easy_setopt(curl.get(), CURLOPT_FOLLOWLOCATION, 1L); res = curl_easy_perform(curl.get()); fclose(fp); diff --git a/third_party/curl/CMakeLists.txt b/third_party/curl/CMakeLists.txt index b5c83a149..7935b3e36 100644 --- a/third_party/curl/CMakeLists.txt +++ b/third_party/curl/CMakeLists.txt @@ -13,14 +13,17 @@ list(APPEND CMAKE_ARGS "-DCURL_USE_LIBSSH2=OFF" "-DBUILD_CURL_EXE=OFF" "-DBUILD_SHARED_LIBS=OFF" - "-DCURL_CA_PATH_SET=OFF" "-DCURL_ZLIB=OFF" "-DHTTP_ONLY=ON" "-DHAVE_POSIX_STRERROR_R=1" "-DBUILD_TESTING=OFF" ) -if(IOS) +if(ANDROID) + list(APPEND CMAKE_ARGS + "-DCURL_CA_PATH=/system/etc/security/cacerts" + ) +elseif(IOS) list(APPEND CMAKE_ARGS "-DPLATFORM=${PLATFORM}" "-DDEPLOYMENT_TARGET=${DEPLOYMENT_TARGET}"