Enable logging for image proxy
This commit is contained in:
parent
3a80fccbab
commit
ba4aa5173d
@ -6,14 +6,15 @@ use Model\Config;
|
|||||||
use PicoFeed\Config\Config as PicoFeedConfig;
|
use PicoFeed\Config\Config as PicoFeedConfig;
|
||||||
use PicoFeed\Filter\Filter;
|
use PicoFeed\Filter\Filter;
|
||||||
use PicoFeed\Client\Client;
|
use PicoFeed\Client\Client;
|
||||||
|
use PicoFeed\Logging\Logger;
|
||||||
|
|
||||||
function isSecureConnection()
|
function isSecureConnection()
|
||||||
{
|
{
|
||||||
return (!empty($_SERVER['HTTPS']) && $_SERVER['HTTPS'] !== 'off');
|
return (!empty($_SERVER['HTTPS']) && $_SERVER['HTTPS'] !== 'off');
|
||||||
}
|
}
|
||||||
|
|
||||||
function addProxyToLink($link) {
|
function addProxyToLink($link)
|
||||||
|
{
|
||||||
if (isSecureConnection() && strpos($link, 'http:') === 0) {
|
if (isSecureConnection() && strpos($link, 'http:') === 0) {
|
||||||
$link = '?action=proxy&url='.urlencode($link);
|
$link = '?action=proxy&url='.urlencode($link);
|
||||||
}
|
}
|
||||||
@ -38,7 +39,7 @@ function addProxyToTags($html, $website, $proxy_images, $cloak_referrer)
|
|||||||
// they do not trigger mixed content warnings.
|
// they do not trigger mixed content warnings.
|
||||||
$config->setFilterImageProxyProtocol('http');
|
$config->setFilterImageProxyProtocol('http');
|
||||||
}
|
}
|
||||||
elseif (! $proxy_images && $cloak_referrer && isSecureConnection() ) {
|
elseif (! $proxy_images && $cloak_referrer && isSecureConnection()) {
|
||||||
// cloaking mode only: if a request from a HTTPS connection to a HTTP
|
// cloaking mode only: if a request from a HTTPS connection to a HTTP
|
||||||
// connection is made, the referrer will be omitted by the browser.
|
// connection is made, the referrer will be omitted by the browser.
|
||||||
// Only the referrer for HTTPS to HTTPs requests needs to be cloaked.
|
// Only the referrer for HTTPS to HTTPs requests needs to be cloaked.
|
||||||
@ -53,11 +54,14 @@ function addProxyToTags($html, $website, $proxy_images, $cloak_referrer)
|
|||||||
|
|
||||||
function download($url)
|
function download($url)
|
||||||
{
|
{
|
||||||
|
if ((bool) Config\get('debug_mode')) {
|
||||||
|
Logger::enable();
|
||||||
|
}
|
||||||
|
|
||||||
$client = Client::getInstance();
|
$client = Client::getInstance();
|
||||||
$client->setUserAgent(Config\HTTP_USER_AGENT);
|
$client->setUserAgent(Config\HTTP_USER_AGENT);
|
||||||
$client->enablePassthroughMode();
|
$client->enablePassthroughMode();
|
||||||
$client->execute($url);
|
$client->execute($url);
|
||||||
|
|
||||||
// does not work
|
|
||||||
Config\write_debug();
|
Config\write_debug();
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user