Made it cope with “accept-encoding” more properly

This commit is contained in:
pezcurrel 2022-12-15 14:38:26 +01:00
parent 8cf8c416ed
commit f7c32d00ef

View file

@ -12,12 +12,11 @@ function getfc($url,$timeout,$headers=[]) {
curl_setopt($curli,CURLOPT_CONNECTTIMEOUT,$timeout);
curl_setopt($curli,CURLOPT_HTTPHEADER,$headers);
curl_setopt($curli,CURLOPT_HEADER,true);
curl_setopt($curli,CURLOPT_ENCODING,'');
$cont=curl_exec($curli);
$headers_sz=curl_getinfo($curli,CURLINFO_HEADER_SIZE);
$headers=substr($cont,0,$headers_sz);
$headers=strtolower(substr($cont,0,$headers_sz));
$cont=substr($cont,$headers_sz);
if (preg_match('/^Content-Encoding: gzip/m',$headers)===1)
$cont=gzdecode($cont);
$emsg=false;
$cerrno=curl_errno($curli);
if ($cerrno>0) {