127 lines
5.1 KiB
Diff
127 lines
5.1 KiB
Diff
--- simplepie.inc 2009-07-11 12:50:28.000000000 +0400
|
|
+++ simplepie.inc 2009-08-05 20:57:30.603042499 +0400
|
|
@@ -446,7 +446,7 @@ class SimplePie
|
|
* @see SimplePie::set_timeout()
|
|
* @access private
|
|
*/
|
|
- var $timeout = 10;
|
|
+ var $timeout = 60;
|
|
|
|
/**
|
|
* @var bool Forces fsockopen() to be used for remote files instead
|
|
@@ -708,7 +708,7 @@
|
|
* @see SimplePie::strip_htmltags()
|
|
* @access private
|
|
*/
|
|
- var $strip_htmltags = array('base', 'blink', 'body', 'doctype', 'embed', 'font', 'form', 'frame', 'frameset', 'html', 'iframe', 'input', 'marquee', 'meta', 'noscript', 'object', 'param', 'script', 'style');
|
|
+ var $strip_htmltags = array('base', 'blink', 'body', 'doctype', 'font', 'form', 'frame', 'frameset', 'html', 'input', 'marquee', 'meta', 'noscript', 'script', 'style');
|
|
|
|
/**
|
|
* The SimplePie class contains feed level data and options
|
|
@@ -1662,6 +1662,12 @@
|
|
$locate =& new $this->locator_class($file, $this->timeout, $this->useragent, $this->file_class, $this->max_checked_feeds, $this->content_type_sniffer_class);
|
|
if (!$locate->is_feed($file))
|
|
{
|
|
+ if ($file->status_code == 401)
|
|
+ {
|
|
+ $this->error = "HTTP 401 Unauthorized. Retry with correct login/password";
|
|
+ SimplePie_Misc::error($this->error, E_USER_NOTICE, __FILE__, __LINE__);
|
|
+ return false;
|
|
+ }
|
|
// We need to unset this so that if SimplePie::set_file() has been called that object is untouched
|
|
unset($file);
|
|
if ($file = $locate->find($this->autodiscovery, $this->all_discovered_feeds))
|
|
@@ -7676,6 +7676,63 @@ class SimplePie_File
|
|
{
|
|
curl_setopt($fp, CURLOPT_ENCODING, '');
|
|
}
|
|
+ // added by FoF (vitalif@yourcmc.ru) to enable environment proxy settings support
|
|
+ // fucking cURL doesn't support this by default
|
|
+ if (preg_match('#^([a-z0-9_]+://)(?:([^/]*:[^/]*)@)([^/@]+([/\?].*)?$)#is', $url, $m))
|
|
+ {
|
|
+ $headers2[] = "Authorization: Basic ".base64_encode(urldecode($m[2]));
|
|
+ }
|
|
+ if ($proxy = getenv("http_proxy"))
|
|
+ {
|
|
+ $useproxy = true;
|
|
+ if ($noproxy = preg_split("#\s*,\s*#is", getenv("no_proxy")))
|
|
+ {
|
|
+ foreach ($noproxy as $n)
|
|
+ {
|
|
+ if (preg_match('#(\d+)\.(\d+)\.(\d+)\.(\d+)/(\d+)#s', $n, $m) &&
|
|
+ preg_match('#^[a-z0-9_]+://(?:[^/]*:[^/]*@)?([^/@]+)(?:/|$|\?)#is', $url, $ip))
|
|
+ {
|
|
+ $mask = array(
|
|
+ max(0x100 - (1 << max( 8-$m[5], 0)), 0),
|
|
+ max(0x100 - (1 << max(16-$m[5], 0)), 0),
|
|
+ max(0x100 - (1 << max(24-$m[5], 0)), 0),
|
|
+ max(0x100 - (1 << max(32-$m[5], 0)), 0),
|
|
+ );
|
|
+ $ip = @gethostbyname($ip[1]);
|
|
+ if (preg_match('#(\d+)\.(\d+)\.(\d+)\.(\d+)#s', $ip, $ipm) &&
|
|
+ (intval($ipm[1]) & $mask[0]) == intval($m[1]) &&
|
|
+ (intval($ipm[2]) & $mask[1]) == intval($m[2]) &&
|
|
+ (intval($ipm[3]) & $mask[2]) == intval($m[3]) &&
|
|
+ (intval($ipm[4]) & $mask[3]) == intval($m[4]))
|
|
+ {
|
|
+ $useproxy = false;
|
|
+ break;
|
|
+ }
|
|
+ }
|
|
+ else
|
|
+ {
|
|
+ $n = preg_replace('/#.*$/is', '', $n);
|
|
+ $n = preg_quote($n);
|
|
+ $n = str_replace('\\*', '.*', $n);
|
|
+ if (preg_match('#'.$n.'#is', $url))
|
|
+ {
|
|
+ $useproxy = false;
|
|
+ break;
|
|
+ }
|
|
+ }
|
|
+ }
|
|
+ }
|
|
+ if ($useproxy)
|
|
+ {
|
|
+ $proxy = preg_replace('#^http://#is', '', $proxy);
|
|
+ $proxy = preg_replace('#/*$#is', '', $proxy);
|
|
+ curl_setopt($fp, CURLOPT_PROXY, $proxy);
|
|
+ }
|
|
+ else
|
|
+ {
|
|
+ curl_setopt($fp, CURLOPT_PROXY, '');
|
|
+ }
|
|
+ }
|
|
curl_setopt($fp, CURLOPT_URL, $url);
|
|
curl_setopt($fp, CURLOPT_HEADER, 1);
|
|
curl_setopt($fp, CURLOPT_RETURNTRANSFER, 1);
|
|
@@ -7690,6 +7747,10 @@ class SimplePie_File
|
|
curl_setopt($fp, CURLOPT_MAXREDIRS, $redirects);
|
|
}
|
|
|
|
+ // added by FoF to enable https and digest authentication
|
|
+ curl_setopt($fp, CURLOPT_SSL_VERIFYPEER, false);
|
|
+ curl_setopt($fp, CURLOPT_HTTPAUTH, CURLAUTH_ANY);
|
|
+
|
|
$this->headers = curl_exec($fp);
|
|
if (curl_errno($fp) === 23 || curl_errno($fp) === 61)
|
|
{
|
|
@@ -14721,7 +14721,7 @@
|
|
// Options
|
|
var $remove_div = true;
|
|
var $image_handler = '';
|
|
- var $strip_htmltags = array('base', 'blink', 'body', 'doctype', 'embed', 'font', 'form', 'frame', 'frameset', 'html', 'iframe', 'input', 'marquee', 'meta', 'noscript', 'object', 'param', 'script', 'style');
|
|
+ var $strip_htmltags = array('base', 'blink', 'body', 'doctype', 'font', 'form', 'frame', 'frameset', 'html', 'input', 'marquee', 'meta', 'noscript', 'script', 'style');
|
|
var $encode_instead_of_strip = false;
|
|
var $strip_attributes = array('bgsound', 'class', 'expr', 'id', 'style', 'onclick', 'onerror', 'onfinish', 'onmouseover', 'onmouseout', 'onfocus', 'onblur', 'lowsrc', 'dynsrc');
|
|
var $strip_comments = false;
|
|
@@ -14810,7 +14810,7 @@
|
|
}
|
|
}
|
|
|
|
- function strip_htmltags($tags = array('base', 'blink', 'body', 'doctype', 'embed', 'font', 'form', 'frame', 'frameset', 'html', 'iframe', 'input', 'marquee', 'meta', 'noscript', 'object', 'param', 'script', 'style'))
|
|
+ function strip_htmltags($tags = array('base', 'blink', 'body', 'doctype', 'font', 'form', 'frame', 'frameset', 'html', 'input', 'marquee', 'meta', 'noscript', 'script', 'style'))
|
|
{
|
|
if ($tags)
|
|
{
|