@@ -121,12 +121,15 @@ public function __construct(string $url, int $timeout = 10, int $redirects = 5,
121121 }
122122 unset($ curl_options [CURLOPT_HTTPHEADER ]);
123123 }
124- if (version_compare (\SimplePie \Misc::get_curl_version (), '7.10.5 ' , '>= ' )) {
124+ if (version_compare (\SimplePie \Misc::get_curl_version (), '7.21.6 ' , '>= ' )) {
125+ curl_setopt ($ fp , CURLOPT_ACCEPT_ENCODING , '' );
126+ } else {
125127 curl_setopt ($ fp , CURLOPT_ENCODING , '' );
126128 }
129+ /** @var non-empty-string $url */
127130 curl_setopt ($ fp , CURLOPT_URL , $ url );
128- curl_setopt ($ fp , CURLOPT_RETURNTRANSFER , 1 );
129- curl_setopt ($ fp , CURLOPT_FAILONERROR , 1 );
131+ curl_setopt ($ fp , CURLOPT_RETURNTRANSFER , true );
132+ curl_setopt ($ fp , CURLOPT_FAILONERROR , true );
130133 curl_setopt ($ fp , CURLOPT_TIMEOUT , $ timeout );
131134 curl_setopt ($ fp , CURLOPT_CONNECTTIMEOUT , $ timeout );
132135 curl_setopt ($ fp , CURLOPT_REFERER , \SimplePie \Misc::url_remove_credentials ($ url ));
@@ -144,7 +147,11 @@ public function __construct(string $url, int $timeout = 10, int $redirects = 5,
144147 $ responseBody = curl_exec ($ fp );
145148 $ responseHeaders .= "\r\n" ;
146149 if (curl_errno ($ fp ) === CURLE_WRITE_ERROR || curl_errno ($ fp ) === CURLE_BAD_CONTENT_ENCODING ) {
147- curl_setopt ($ fp , CURLOPT_ENCODING , 'none ' );
150+ if (version_compare (\SimplePie \Misc::get_curl_version (), '7.21.6 ' , '>= ' )) {
151+ curl_setopt ($ fp , CURLOPT_ACCEPT_ENCODING , 'none ' );
152+ } else {
153+ curl_setopt ($ fp , CURLOPT_ENCODING , 'none ' );
154+ }
148155 $ responseHeaders = '' ;
149156 $ responseBody = curl_exec ($ fp );
150157 $ responseHeaders .= "\r\n" ;
0 commit comments