cmake/0005-ctest-Restore-support-for-http-redirects-during-Subm.patch

45 lines
1.7 KiB
Diff
Raw Normal View History

From 26ce8dc290710ddbad49335f36968d850176b634 Mon Sep 17 00:00:00 2001
From: Zack Galbreath <zack.galbreath@kitware.com>
Date: Thu, 7 Sep 2023 12:12:30 -0400
Subject: [PATCH 5/9] ctest: Restore support for http redirects during Submit
step
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit
After CDash PR 1519 introduced HTTP status codes greater than 200 for
various error cases, CMake commit b7c871f745 (ctest: Update ctest_submit
for CDash behavior change, 2023-07-24, v3.27.1~3^2) modified CTest's
submit handler to check the status returned by CDash and throw an error
when this status is not equal to 200.
That change had the unintended side effect of causing CTest submissions
to fail when uploading results to a URL that returns a redirect status
code (3xx). Fix this by configuring cURL to follow the redirect. The
status cURL reports to CTest is now 200 instead of 3xx when CDash is
located behind a redirect.
Fixes: #25159
Signed-off-by: Björn Esser <besser82@fedoraproject.org>
---
Source/CTest/cmCTestSubmitHandler.cxx | 3 +++
1 file changed, 3 insertions(+)
diff --git a/Source/CTest/cmCTestSubmitHandler.cxx b/Source/CTest/cmCTestSubmitHandler.cxx
index 7d4b0a847c..c04f23a1fe 100644
--- a/Source/CTest/cmCTestSubmitHandler.cxx
+++ b/Source/CTest/cmCTestSubmitHandler.cxx
@@ -309,6 +309,9 @@ bool cmCTestSubmitHandler::SubmitUsingHTTP(
// specify target
::curl_easy_setopt(curl, CURLOPT_URL, upload_as.c_str());
+ // follow redirects
+ ::curl_easy_setopt(curl, CURLOPT_FOLLOWLOCATION, 1);
+
// CURLAUTH_BASIC is default, and here we allow additional methods,
// including more secure ones
::curl_easy_setopt(curl, CURLOPT_HTTPAUTH, CURLAUTH_ANY);
--
2.41.0