mirror of
https://github.com/friendica/friendica
synced 2025-04-29 21:04:24 +02:00
HTTPRequest: Replace getInfo() with new parameter 'content_length'
This commit is contained in:
parent
1a42f35a3c
commit
f3cd973cbe
7 changed files with 15 additions and 30 deletions
|
@ -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;
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue