HTTPRequest: Replace getInfo() with new parameter 'content_length'

This commit is contained in:
Philipp 2021-08-20 19:48:20 +02:00
parent 89f718ec72
commit 3c074ab315
No known key found for this signature in database
GPG key ID: 9A28B7D4FF5667BD
7 changed files with 14 additions and 25 deletions

View file

@ -424,16 +424,11 @@ class Probe
*/
private static function getHideStatus($url)
{
$curlResult = DI::httpRequest()->get($url);
$curlResult = DI::httpRequest()->get($url, false, ['content_length' => 1000000]);
if (!$curlResult->isSuccess()) {
return false;
}
// If the file is too large then exit
if (($curlResult->getInfo()['download_content_length'] ?? 0) > 1000000) {
return false;
}
// If it isn't a HTML file then exit
if (($curlResult->getContentType() != '') && !strstr(strtolower($curlResult->getContentType()), 'html')) {
return false;