From 90afb780142734a28678037b83c06ca6564751ba Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E6=B5=81=E7=81=AB=E8=A1=8C=E8=80=85?= Date: Mon, 11 Oct 2021 16:32:49 +0800 Subject: [PATCH] =?UTF-8?q?cos=E5=9C=B0=E5=9D=80=E5=8D=95=E7=8B=AC?= =?UTF-8?q?=E5=88=A4=E6=96=AD?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/Common/Utils.php | 9 ++++++--- 1 file changed, 6 insertions(+), 3 deletions(-) diff --git a/src/Common/Utils.php b/src/Common/Utils.php index be20cda..74f2076 100644 --- a/src/Common/Utils.php +++ b/src/Common/Utils.php @@ -273,11 +273,14 @@ class Utils public static function downLoadFile($url, $path = '') { - $url = self::ssrfDefBlack($url,$host); - if (!$url) return false; + $host = null; + if (!self::isCosUrl($url)) { + $url = self::ssrfDefBlack($url, $host); + if (!$url) return false; + } $ch = curl_init(); curl_setopt($ch, CURLOPT_CUSTOMREQUEST, 'GET'); - curl_setopt($ch,CURLOPT_HTTPHEADER,['HOST: '.$host]); + !empty($host)&&curl_setopt($ch,CURLOPT_HTTPHEADER,['HOST: '.$host]); curl_setopt($ch, CURLOPT_SSL_VERIFYPEER, false); curl_setopt($ch, CURLOPT_URL, $url); curl_setopt($ch, CURLOPT_FOLLOWLOCATION, false); -- Gitee