Enable logging for image proxy

This commit is contained in:
Frederic Guillot 2015-02-07 11:09:43 -05:00
parent 3a80fccbab
commit ba4aa5173d

View File

@ -6,14 +6,15 @@ use Model\Config;
use PicoFeed\Config\Config as PicoFeedConfig;
use PicoFeed\Filter\Filter;
use PicoFeed\Client\Client;
use PicoFeed\Logging\Logger;
function isSecureConnection()
{
return (!empty($_SERVER['HTTPS']) && $_SERVER['HTTPS'] !== 'off');
}
function addProxyToLink($link) {
function addProxyToLink($link)
{
if (isSecureConnection() && strpos($link, 'http:') === 0) {
$link = '?action=proxy&url='.urlencode($link);
}
@ -53,11 +54,14 @@ function addProxyToTags($html, $website, $proxy_images, $cloak_referrer)
function download($url)
{
if ((bool) Config\get('debug_mode')) {
Logger::enable();
}
$client = Client::getInstance();
$client->setUserAgent(Config\HTTP_USER_AGENT);
$client->enablePassthroughMode();
$client->execute($url);
// does not work
Config\write_debug();
}