From d772c14f5564d7a96d033b361ef9b0e527389a1c Mon Sep 17 00:00:00 2001 From: "copilot-swe-agent[bot]" <198982749+Copilot@users.noreply.github.com> Date: Fri, 24 Apr 2026 19:20:45 +0000 Subject: [PATCH] domain-check: replace curl with GuzzleHttp\Client in ConfigurationManager --- php/src/Data/ConfigurationManager.php | 25 +++++++++++++------------ 1 file changed, 13 insertions(+), 12 deletions(-) diff --git a/php/src/Data/ConfigurationManager.php b/php/src/Data/ConfigurationManager.php index b226a139..e593068c 100644 --- a/php/src/Data/ConfigurationManager.php +++ b/php/src/Data/ConfigurationManager.php @@ -5,6 +5,8 @@ namespace AIO\Data; use AIO\Auth\PasswordGenerator; use AIO\Controller\DockerController; +use GuzzleHttp\Client; +use GuzzleHttp\Exception\TransferException; class ConfigurationManager { @@ -530,23 +532,22 @@ class ConfigurationManager } // Check if response is correct - $ch = curl_init(); - if ($ch === false) { - throw new InvalidSettingConfigurationException('Could not init curl! Please check the logs!'); - } $testUrl = $protocol . $domain . ':443'; - curl_setopt($ch, CURLOPT_URL, $testUrl); - curl_setopt($ch, CURLOPT_RETURNTRANSFER, true); - curl_setopt($ch, CURLOPT_CONNECTTIMEOUT, 10); - curl_setopt($ch, CURLOPT_TIMEOUT, 10); - $response = (string)curl_exec($ch); - # Get rid of trailing \n - $response = str_replace("\n", "", $response); + $errorMessage = ''; + $guzzleClient = new Client(['connect_timeout' => 10, 'timeout' => 10, 'http_errors' => false]); + try { + $guzzleResponse = $guzzleClient->get($testUrl); + # Get rid of trailing \n + $response = str_replace("\n", "", (string)$guzzleResponse->getBody()); + } catch (TransferException $e) { + $response = ''; + $errorMessage = 'The error message was: ' . $e->getMessage(); + } if ($response !== $instanceID) { error_log('The response of the connection attempt to "' . $testUrl . '" was: ' . $response); error_log('Expected was: ' . $instanceID); - error_log('The error message was: ' . curl_error($ch)); + error_log($errorMessage); $notice = "Domain does not point to this server or the reverse proxy is not configured correctly. See the mastercontainer logs for more details. ('sudo docker logs -f nextcloud-aio-mastercontainer')"; if ($port === '443') { $notice .= " If you should be using Cloudflare, make sure to disable the Cloudflare Proxy feature as it might block the domain validation. Same for any other firewall or service that blocks unencrypted access on port 443.";