From 6c4f5b851d68c5ab726f6c5e3e9299d2b8d3af60 Mon Sep 17 00:00:00 2001 From: Laurent Destailleur Date: Wed, 7 Apr 2021 23:31:16 +0200 Subject: [PATCH] Use all param of getURLContent --- htdocs/admin/system/filecheck.php | 2 +- htdocs/core/lib/geturl.lib.php | 1 + 2 files changed, 2 insertions(+), 1 deletion(-) diff --git a/htdocs/admin/system/filecheck.php b/htdocs/admin/system/filecheck.php index e6e95872c91..ab42039b98a 100644 --- a/htdocs/admin/system/filecheck.php +++ b/htdocs/admin/system/filecheck.php @@ -158,7 +158,7 @@ if (GETPOST('target') == 'local') { } } if (GETPOST('target') == 'remote') { - $xmlarray = getURLContent($xmlremote); + $xmlarray = getURLContent($xmlremote, 'GET', '', 1, array(), array('http', 'https'), 0); // Accept http or https links on external remote server only // Return array('content'=>response,'curl_error_no'=>errno,'curl_error_msg'=>errmsg...) if (!$xmlarray['curl_error_no'] && $xmlarray['http_code'] != '400' && $xmlarray['http_code'] != '404') { diff --git a/htdocs/core/lib/geturl.lib.php b/htdocs/core/lib/geturl.lib.php index d624e2e0ace..435f02f1da0 100644 --- a/htdocs/core/lib/geturl.lib.php +++ b/htdocs/core/lib/geturl.lib.php @@ -190,6 +190,7 @@ function getURLContent($url, $postorget = 'GET', $param = '', $followlocation = $info = curl_getinfo($ch); // Reading of request must be done after sending request $http_code = $info['http_code']; + if ($followlocation && ($http_code == 301 || $http_code == 302 || $http_code == 303 || $http_code == 307)) { $newUrl = $info['redirect_url']; $maxRedirection--;