summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorBrad King <brad.king@kitware.com>2024-08-15 13:35:15 (GMT)
committerKitware Robot <kwrobot@kitware.com>2024-08-15 13:35:35 (GMT)
commit16b684786181b63a9e6798ce765dff2979a55ab5 (patch)
tree844073e736860b96816a8d2469cf01e940d7f06a
parentd88682dff6bf053e5bbdc10accf5d6825303e656 (diff)
parent7486f468fb982f8362252b70987aca13ddf95690 (diff)
downloadCMake-16b684786181b63a9e6798ce765dff2979a55ab5.zip
CMake-16b684786181b63a9e6798ce765dff2979a55ab5.tar.gz
CMake-16b684786181b63a9e6798ce765dff2979a55ab5.tar.bz2
Merge topic 'curl-http2' into release-3.30
7486f468fb curl: Avoid using HTTP/2 with curl 8.7.x due to bug in error codes Acked-by: Kitware Robot <kwrobot@kitware.com> Acked-by: buildbot <buildbot@kitware.com> Merge-request: !9728
-rw-r--r--Source/CTest/cmCTestCurl.cxx2
-rw-r--r--Source/CTest/cmCTestSubmitHandler.cxx2
-rw-r--r--Source/cmCurl.cxx12
-rw-r--r--Source/cmCurl.h2
-rw-r--r--Source/cmFileCommand.cxx4
5 files changed, 18 insertions, 4 deletions
diff --git a/Source/CTest/cmCTestCurl.cxx b/Source/CTest/cmCTestCurl.cxx
index b8e5db1..7137e63 100644
--- a/Source/CTest/cmCTestCurl.cxx
+++ b/Source/CTest/cmCTestCurl.cxx
@@ -22,7 +22,7 @@ cmCTestCurl::cmCTestCurl(cmCTest* ctest)
cmCurlInitOnce();
// In windows, this will init the winsock stuff
::curl_global_init(CURL_GLOBAL_ALL);
- this->Curl = curl_easy_init();
+ this->Curl = cm_curl_easy_init();
}
cmCTestCurl::~cmCTestCurl()
diff --git a/Source/CTest/cmCTestSubmitHandler.cxx b/Source/CTest/cmCTestSubmitHandler.cxx
index 85c77be..fdf3178 100644
--- a/Source/CTest/cmCTestSubmitHandler.cxx
+++ b/Source/CTest/cmCTestSubmitHandler.cxx
@@ -177,7 +177,7 @@ bool cmCTestSubmitHandler::SubmitUsingHTTP(
cmCTestCurlOpts curlOpts(this->CTest);
for (std::string const& file : files) {
/* get a curl handle */
- curl = curl_easy_init();
+ curl = cm_curl_easy_init();
if (curl) {
cmCurlSetCAInfo(curl);
if (curlOpts.TLSVersionOpt) {
diff --git a/Source/cmCurl.cxx b/Source/cmCurl.cxx
index 65fccd0..51b95c3 100644
--- a/Source/cmCurl.cxx
+++ b/Source/cmCurl.cxx
@@ -226,3 +226,15 @@ std::string cmCurlFixFileURL(std::string url)
return url;
}
+
+::CURL* cm_curl_easy_init()
+{
+ ::CURL* curl = curl_easy_init();
+ if (curl_version_info_data* cv = curl_version_info(CURLVERSION_FIRST)) {
+ // curl 8.7.x returns incorrect HTTP/2 error codes.
+ if (cv->version_num >= 0x080700 && cv->version_num < 0x080800) {
+ curl_easy_setopt(curl, CURLOPT_HTTP_VERSION, CURL_HTTP_VERSION_1_1);
+ }
+ }
+ return curl;
+}
diff --git a/Source/cmCurl.h b/Source/cmCurl.h
index bb2221f..2088e3d 100644
--- a/Source/cmCurl.h
+++ b/Source/cmCurl.h
@@ -18,3 +18,5 @@ std::string cmCurlSetCAInfo(::CURL* curl, const std::string& cafile = {});
std::string cmCurlSetNETRCOption(::CURL* curl, const std::string& netrc_level,
const std::string& netrc_file);
std::string cmCurlFixFileURL(std::string url);
+
+::CURL* cm_curl_easy_init();
diff --git a/Source/cmFileCommand.cxx b/Source/cmFileCommand.cxx
index 6265f82..4797c06 100644
--- a/Source/cmFileCommand.cxx
+++ b/Source/cmFileCommand.cxx
@@ -2117,7 +2117,7 @@ bool HandleDownloadCommand(std::vector<std::string> const& args,
::CURL* curl;
cmCurlInitOnce();
::curl_global_init(CURL_GLOBAL_DEFAULT);
- curl = ::curl_easy_init();
+ curl = cm_curl_easy_init();
if (!curl) {
status.SetError("DOWNLOAD error initializing curl.");
return false;
@@ -2491,7 +2491,7 @@ bool HandleUploadCommand(std::vector<std::string> const& args,
::CURL* curl;
cmCurlInitOnce();
::curl_global_init(CURL_GLOBAL_DEFAULT);
- curl = ::curl_easy_init();
+ curl = cm_curl_easy_init();
if (!curl) {
status.SetError("UPLOAD error initializing curl.");
fclose(fin);