From 9a11f7b5b65e4581377065d60b706ae3acc4721c Mon Sep 17 00:00:00 2001 From: ikkez Date: Fri, 4 Nov 2022 23:26:13 +0100 Subject: [PATCH] add option to adjust accept-encoding in curl engine #355 --- web.php | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/web.php b/web.php index 4019ff4f..c40965e0 100644 --- a/web.php +++ b/web.php @@ -359,7 +359,8 @@ protected function _curl($url,$options) { curl_setopt($curl,CURLOPT_POSTFIELDS,$options['content']); if (isset($options['proxy'])) curl_setopt($curl,CURLOPT_PROXY,$options['proxy']); - curl_setopt($curl,CURLOPT_ENCODING,'gzip,deflate'); + curl_setopt($curl,CURLOPT_ENCODING,isset($options['encoding']) + ? $options['encoding'] : 'gzip,deflate'); $timeout=isset($options['timeout'])? $options['timeout']: ini_get('default_socket_timeout'); @@ -617,7 +618,8 @@ function request($url,array $options=NULL) { } $this->subst($options['header'], [ - 'Accept-Encoding: gzip,deflate', + 'Accept-Encoding: '.(isset($options['encoding'])? + $options['encoding']:'gzip,deflate'), 'User-Agent: '.(isset($options['user_agent'])? $options['user_agent']: 'Mozilla/5.0 (compatible; '.php_uname('s').')'),