From ce661c43996211f146096186ac9bec9733f498c0 Mon Sep 17 00:00:00 2001 From: Zack Galbreath Date: Thu, 7 Sep 2023 12:12:30 -0400 Subject: ctest: Restore support for http redirects during Submit step 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 --- Source/CTest/cmCTestSubmitHandler.cxx | 3 +++ 1 file changed, 3 insertions(+) diff --git a/Source/CTest/cmCTestSubmitHandler.cxx b/Source/CTest/cmCTestSubmitHandler.cxx index 9161515..6ecf36f 100644 --- a/Source/CTest/cmCTestSubmitHandler.cxx +++ b/Source/CTest/cmCTestSubmitHandler.cxx @@ -308,6 +308,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); -- cgit v0.12