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

This commit is contained in:
Philipp 2020-10-09 20:52:52 +02:00
parent 1a42f35a3c
commit f3cd973cbe
No known key found for this signature in database
GPG key ID: 9A28B7D4FF5667BD
7 changed files with 15 additions and 30 deletions

View file

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