]> source.dussan.org Git - nextcloud-server.git/commitdiff
fix(settings): Adjust order of parameters for `runRequest` 44082/head
authorFerdinand Thiessen <opensource@fthiessen.de>
Fri, 8 Mar 2024 10:21:51 +0000 (11:21 +0100)
committerFerdinand Thiessen <opensource@fthiessen.de>
Fri, 8 Mar 2024 10:21:51 +0000 (11:21 +0100)
Fixing invalid request to host `HEAD`.

Signed-off-by: Ferdinand Thiessen <opensource@fthiessen.de>
apps/settings/lib/SetupChecks/CheckServerResponseTrait.php
apps/settings/lib/SetupChecks/WellKnownUrls.php

index aafade1526a1126bebad436bf8966f9b3c8ae319..e78ec60220911b3f68485258035a9a09de367dc6 100644 (file)
@@ -74,8 +74,8 @@ trait CheckServerResponseTrait {
 
        /**
         * Run a HTTP request to check header
-        * @param string $url The relative URL to check
         * @param string $method The HTTP method to use
+        * @param string $url The relative URL to check
         * @param array{ignoreSSL?: bool, httpErrors?: bool, options?: array} $options Additional options, like
         *                                                 [
         *                                                  // Ignore invalid SSL certificates (e.g. self signed)
@@ -86,7 +86,7 @@ trait CheckServerResponseTrait {
         *
         * @return Generator<int, IResponse>
         */
-       protected function runRequest(string $url, string $method, array $options = []): Generator {
+       protected function runRequest(string $method, string $url, array $options = []): Generator {
                $options = array_merge(['ignoreSSL' => true, 'httpErrors' => true], $options);
 
                $client = $this->clientService->newClient();
@@ -95,7 +95,7 @@ trait CheckServerResponseTrait {
 
                foreach ($this->getTestUrls($url) as $testURL) {
                        try {
-                               yield $client->request($testURL, $method, $requestOptions);
+                               yield $client->request($method, $testURL, $requestOptions);
                        } catch (\Throwable $e) {
                                $this->logger->debug('Can not connect to local server for running setup checks', ['exception' => $e, 'url' => $testURL]);
                        }
@@ -110,7 +110,7 @@ trait CheckServerResponseTrait {
         * @return Generator<int, IResponse>
         */
        protected function runHEAD(string $url, bool $ignoreSSL = true, bool $httpErrors = true): Generator {
-               return $this->runRequest($url, 'HEAD', ['ignoreSSL' => $ignoreSSL, 'httpErrors' => $httpErrors]);
+               return $this->runRequest('HEAD', $url, ['ignoreSSL' => $ignoreSSL, 'httpErrors' => $httpErrors]);
        }
 
        protected function getRequestOptions(bool $ignoreSSL, bool $httpErrors): array {
index 933f82b614f079471dd917f977a59997ee019f50..f30bf21769005529d211c3ec6a26a5d7c95c9597 100644 (file)
@@ -70,7 +70,7 @@ class WellKnownUrls implements ISetupCheck {
 
                foreach ($urls as [$verb,$url,$validStatuses,$checkCustomHeader]) {
                        $works = null;
-                       foreach ($this->runRequest($url, $verb, ['httpErrors' => false, 'options' => ['allow_redirects' => ['track_redirects' => true]]]) as $response) {
+                       foreach ($this->runRequest($verb, $url, ['httpErrors' => false, 'options' => ['allow_redirects' => ['track_redirects' => true]]]) as $response) {
                                // Check that the response status matches
                                $works = in_array($response->getStatusCode(), $validStatuses);
                                // and (if needed) the custom Nextcloud header is set