From: ArthurHoaro Date: Tue, 23 Jan 2018 17:41:38 +0000 (+0100) Subject: Merge pull request #977 from ArthurHoaro/feature/dl-filter X-Git-Tag: v0.9.4~7 X-Git-Url: https://git.immae.eu/?p=github%2Fshaarli%2FShaarli.git;a=commitdiff_plain;h=d449f79a0d7ca808b891baf73b9e25ce7f7e48fe Merge pull request #977 from ArthurHoaro/feature/dl-filter Extract the title/charset during page download, and check content type --- d449f79a0d7ca808b891baf73b9e25ce7f7e48fe diff --cc application/HttpUtils.php index c9371b55,2edf5ce2..83a4c5e2 --- a/application/HttpUtils.php +++ b/application/HttpUtils.php @@@ -75,8 -77,12 +77,12 @@@ function get_http_response($url, $timeo curl_setopt($ch, CURLOPT_TIMEOUT, $timeout); curl_setopt($ch, CURLOPT_USERAGENT, $userAgent); + if (is_callable($curlWriteFunction)) { + curl_setopt($ch, CURLOPT_WRITEFUNCTION, $curlWriteFunction); + } + // Max download size management - curl_setopt($ch, CURLOPT_BUFFERSIZE, 1024); + curl_setopt($ch, CURLOPT_BUFFERSIZE, 1024*16); curl_setopt($ch, CURLOPT_NOPROGRESS, false); curl_setopt($ch, CURLOPT_PROGRESSFUNCTION, function($arg0, $arg1, $arg2, $arg3, $arg4 = 0) use ($maxBytes)