1
0
mirror of https://git.tt-rss.org/git/tt-rss.git synced 2025-12-13 01:36:30 +00:00

* limit progressfunction debugging to size quota exceeded notifications

* af_redditimgur: reparent generated iframes outside of post table
This commit is contained in:
Andrew Dolgov
2021-03-13 11:18:59 +03:00
parent 4e81233ac9
commit 4ddcd54e8d
2 changed files with 86 additions and 48 deletions

View File

@@ -271,10 +271,15 @@ class UrlHelper {
// holy shit closures in php
// download & upload are *expected* sizes respectively, could be zero
curl_setopt($ch, CURLOPT_PROGRESSFUNCTION, function($curl_handle, $download_size, $downloaded, $upload_size, $uploaded) use( &$max_size) {
Debug::log("[curl progressfunction] $downloaded $max_size", Debug::$LOG_EXTENDED);
curl_setopt($ch, CURLOPT_PROGRESSFUNCTION, function($curl_handle, $download_size, $downloaded, $upload_size, $uploaded) use(&$max_size, $url) {
//Debug::log("[curl progressfunction] $downloaded $max_size", Debug::$LOG_EXTENDED);
return ($downloaded > $max_size) ? 1 : 0; // if max size is set, abort when exceeding it
if ($downloaded > $max_size) {
Debug::log("curl: reached max size of $max_size bytes requesting $url, aborting.", Debug::LOG_VERBOSE);
return 1;
}
return 0;
});
}