FeedOnFeeds/simplepie/simplepie.patch

88 lines
4.0 KiB
Diff

--- simplepie.inc.o 2010-03-03 16:25:08.982938422 +0300
+++ simplepie.inc 2010-03-03 16:26:19.678998009 +0300
@@ -43,6 +43,10 @@
* @todo phpDoc comments
*/
+/* added by FoF (vitalif@yourcmc.ru) to enable environment proxy settings support */
+/* fucking cURL doesn't support this by default */
+require_once(dirname(dirname(__FILE__)).'/curl-env-proxy.php');
+
/**
* SimplePie Name
*/
@@ -446,7 +450,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 +712,7 @@ class SimplePie
* @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 +1666,12 @@ class SimplePie
$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 +7686,13 @@ class SimplePie_File
{
curl_setopt($fp, CURLOPT_ENCODING, '');
}
+ if (preg_match('#^([a-z0-9_]+://)(?:([^/]*:[^/]*)@)([^/@]+([/\?].*)?$)#is', $url, $m))
+ {
+ $headers2[] = "Authorization: Basic ".base64_encode(urldecode($m[2]));
+ }
+ // added by FoF (vitalif@yourcmc.ru) to enable environment proxy settings support
+ // fucking cURL doesn't support this by default
+ curl_set_env_proxy($fp, $url);
curl_setopt($fp, CURLOPT_URL, $url);
curl_setopt($fp, CURLOPT_HEADER, 1);
curl_setopt($fp, CURLOPT_RETURNTRANSFER, 1);
@@ -7690,6 +7707,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)
{
@@ -14654,7 +14675,7 @@ class SimplePie_Sanitize
// 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;
@@ -14743,7 +14764,7 @@ class SimplePie_Sanitize
}
}
- 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)
{