From 58603172b1c4b2ace16b1cb1fb9fd74a2ed6c6ae Mon Sep 17 00:00:00 2001 From: Rodolfo Berrios <20590102+rodber@users.noreply.github.com> Date: Fri, 7 Jan 2022 13:21:16 -0300 Subject: [PATCH] disable fetch url follow redirect --- lib/G/functions.php | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/lib/G/functions.php b/lib/G/functions.php index 3a11357c..2b052468 100644 --- a/lib/G/functions.php +++ b/lib/G/functions.php @@ -1648,7 +1648,7 @@ function fetch_url($url, $file = null, $options = []) curl_setopt($ch, CURLOPT_RETURNTRANSFER, 1); curl_setopt($ch, CURLOPT_AUTOREFERER, 1); curl_setopt($ch, CURLOPT_TIMEOUT, 60); - curl_setopt($ch, CURLOPT_FOLLOWLOCATION, 1); + curl_setopt($ch, CURLOPT_FOLLOWLOCATION, 0); curl_setopt($ch, CURLOPT_HEADER, 0); curl_setopt($ch, CURLOPT_FAILONERROR, 0); curl_setopt($ch, CURLOPT_ENCODING, 'gzip'); @@ -1689,7 +1689,7 @@ function fetch_url($url, $file = null, $options = []) } } else { $context = stream_context_create([ - 'http' => ['ignore_errors' => true], + 'http' => ['ignore_errors' => true, 'follow_location' => false], ]); $result = @file_get_contents($url, false, $context); if (!$result) { @@ -1718,7 +1718,7 @@ function getUrlHeaders($url, $options = []) curl_setopt($ch, CURLOPT_NOBODY, 1); curl_setopt($ch, CURLOPT_AUTOREFERER, 1); curl_setopt($ch, CURLOPT_SSL_VERIFYPEER, 0); - curl_setopt($ch, CURLOPT_FOLLOWLOCATION, 1); + curl_setopt($ch, CURLOPT_FOLLOWLOCATION, 0); curl_setopt($ch, CURLOPT_RETURNTRANSFER, 1); curl_setopt($ch, CURLOPT_USERAGENT, 'Mozilla/5.0 (Windows NT 6.3; WOW64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/43.0.2357.81 Safari/537.36'); // Inject custom options