summaryrefslogtreecommitdiffstats
path: root/vendor/fguillot
diff options
context:
space:
mode:
authorBernhard Posselt <dev@bernhard-posselt.com>2015-08-13 09:23:09 +0200
committerBernhard Posselt <dev@bernhard-posselt.com>2015-08-13 09:23:42 +0200
commitde378700110c202bc25e9378cb5fdb852d27f07a (patch)
tree52d7d9ffb62d2dc732c54942fea59501473545d4 /vendor/fguillot
parente282e47ac4b6cc2d309985996d02d8a9093050e4 (diff)
remove net url package and update composer deps
Diffstat (limited to 'vendor/fguillot')
-rw-r--r--vendor/fguillot/picofeed/lib/PicoFeed/Client/Curl.php19
-rw-r--r--vendor/fguillot/picofeed/lib/PicoFeed/Client/Url.php20
-rw-r--r--vendor/fguillot/picofeed/lib/PicoFeed/Filter/Attribute.php1
-rw-r--r--vendor/fguillot/picofeed/lib/PicoFeed/Rules/www.lesnumeriques.com.php25
-rw-r--r--vendor/fguillot/picofeed/lib/PicoFeed/Syndication/Rss20.php2
-rw-r--r--vendor/fguillot/picofeed/tests/Client/ClientTest.php2
-rw-r--r--vendor/fguillot/picofeed/tests/Client/CurlTest.php2
-rw-r--r--vendor/fguillot/picofeed/tests/Client/UrlTest.php6
-rw-r--r--vendor/fguillot/picofeed/tests/Syndication/Rss20WriterTest.php10
9 files changed, 61 insertions, 26 deletions
diff --git a/vendor/fguillot/picofeed/lib/PicoFeed/Client/Curl.php b/vendor/fguillot/picofeed/lib/PicoFeed/Client/Curl.php
index 0c609db29..3e408b6d8 100644
--- a/vendor/fguillot/picofeed/lib/PicoFeed/Client/Curl.php
+++ b/vendor/fguillot/picofeed/lib/PicoFeed/Client/Curl.php
@@ -243,8 +243,7 @@ class Curl extends Client
curl_setopt($ch, CURLOPT_CONNECTTIMEOUT, $this->timeout);
curl_setopt($ch, CURLOPT_USERAGENT, $this->user_agent);
curl_setopt($ch, CURLOPT_HTTPHEADER, $this->prepareHeaders());
- curl_setopt($ch, CURLOPT_FOLLOWLOCATION, ini_get('open_basedir') === '');
- curl_setopt($ch, CURLOPT_MAXREDIRS, $this->max_redirects);
+ curl_setopt($ch, CURLOPT_FOLLOWLOCATION, false);
curl_setopt($ch, CURLOPT_ENCODING, '');
curl_setopt($ch, CURLOPT_COOKIEJAR, 'php://memory');
curl_setopt($ch, CURLOPT_COOKIEFILE, 'php://memory');
@@ -310,8 +309,7 @@ class Curl extends Client
list($status, $headers) = HttpHeaders::parse(explode("\n", $this->response_headers[$this->response_headers_count - 1]));
- // When restricted with open_basedir
- if ($this->needToHandleRedirection($follow_location, $status)) {
+ if ($follow_location && ($status == 301 || $status == 302)) {
return $this->handleRedirection($headers['Location']);
}
@@ -323,19 +321,6 @@ class Curl extends Client
}
/**
- * Check if the redirection have to be handled manually
- *
- * @access private
- * @param boolean $follow_location Flag
- * @param integer $status HTTP status code
- * @return boolean
- */
- private function needToHandleRedirection($follow_location, $status)
- {
- return $follow_location && ini_get('open_basedir') !== '' && ($status == 301 || $status == 302);
- }
-
- /**
* Handle manually redirections when there is an open base dir restriction
*
* @access private
diff --git a/vendor/fguillot/picofeed/lib/PicoFeed/Client/Url.php b/vendor/fguillot/picofeed/lib/PicoFeed/Client/Url.php
index f03305c02..396a1085e 100644
--- a/vendor/fguillot/picofeed/lib/PicoFeed/Client/Url.php
+++ b/vendor/fguillot/picofeed/lib/PicoFeed/Client/Url.php
@@ -149,6 +149,24 @@ class Url
}
/**
+ * Filters the path of a URI
+ *
+ * Imported from Guzzle library: https://github.com/guzzle/psr7/blob/master/src/Uri.php#L568-L582
+ *
+ * @access public
+ * @param $path
+ * @return string
+ */
+ public function filterPath($path, $charUnreserved = 'a-zA-Z0-9_\-\.~', $charSubDelims = '!\$&\'\(\)\*\+,;=')
+ {
+ return preg_replace_callback(
+ '/(?:[^' . $charUnreserved . $charSubDelims . ':@\/%]+|%(?![A-Fa-f0-9]{2}))/',
+ function (array $matches) { return rawurlencode($matches[0]); },
+ $path
+ );
+ }
+
+ /**
* Get the path
*
* @access public
@@ -156,7 +174,7 @@ class Url
*/
public function getPath()
{
- return empty($this->components['path']) ? '' : $this->components['path'];
+ return $this->filterPath(empty($this->components['path']) ? '' : $this->components['path']);
}
/**
diff --git a/vendor/fguillot/picofeed/lib/PicoFeed/Filter/Attribute.php b/vendor/fguillot/picofeed/lib/PicoFeed/Filter/Attribute.php
index ec1dac417..1c5842df4 100644
--- a/vendor/fguillot/picofeed/lib/PicoFeed/Filter/Attribute.php
+++ b/vendor/fguillot/picofeed/lib/PicoFeed/Filter/Attribute.php
@@ -149,6 +149,7 @@ class Attribute
'feeds.feedburner.com',
'share.feedsportal.com',
'da.feedsportal.com',
+ 'rc.feedsportal.com',
'rss.feedsportal.com',
'res.feedsportal.com',
'res1.feedsportal.com',
diff --git a/vendor/fguillot/picofeed/lib/PicoFeed/Rules/www.lesnumeriques.com.php b/vendor/fguillot/picofeed/lib/PicoFeed/Rules/www.lesnumeriques.com.php
new file mode 100644
index 000000000..8fe629922
--- /dev/null
+++ b/vendor/fguillot/picofeed/lib/PicoFeed/Rules/www.lesnumeriques.com.php
@@ -0,0 +1,25 @@
+<?php
+return array(
+ 'grabber' => array(
+ '%.*%' => array(
+ 'test_url' => 'http://www.lesnumeriques.com/blender/kitchenaid-diamond-5ksb1585-p27473/test.html',
+ 'body' => array(
+ '//*[@id="product-content"]',
+ '//*[@id="news-content"]',
+ '//*[@id="article-content"]',
+ ),
+ 'strip' => array(
+ '//form',
+ '//div[contains(@class, "price-v4"])',
+ '//div[contains(@class, "authors-and-date")]',
+ '//div[contains(@class, "mini-product")]',
+ '//div[@id="articles-related-authors"]',
+ '//div[@id="tags-socials"]',
+ '//div[@id="user-reviews"]',
+ '//div[@id="product-reviews"]',
+ '//div[@id="publication-breadcrumbs-and-date"]',
+ '//div[@id="publication-breadcrumbs-and-date"]',
+ )
+ )
+ )
+); \ No newline at end of file
diff --git a/vendor/fguillot/picofeed/lib/PicoFeed/Syndication/Rss20.php b/vendor/fguillot/picofeed/lib/PicoFeed/Syndication/Rss20.php
index 69d6a2114..32b45e797 100644
--- a/vendor/fguillot/picofeed/lib/PicoFeed/Syndication/Rss20.php
+++ b/vendor/fguillot/picofeed/lib/PicoFeed/Syndication/Rss20.php
@@ -179,7 +179,7 @@ class Rss20 extends Writer
{
$xml->appendChild($this->dom->createElement(
'pubDate',
- date(DATE_RFC822, $value ?: time())
+ date(DATE_RSS, $value ?: time())
));
}
diff --git a/vendor/fguillot/picofeed/tests/Client/ClientTest.php b/vendor/fguillot/picofeed/tests/Client/ClientTest.php
index b50837230..4099a7158 100644
--- a/vendor/fguillot/picofeed/tests/Client/ClientTest.php
+++ b/vendor/fguillot/picofeed/tests/Client/ClientTest.php
@@ -28,7 +28,7 @@ class ClientTest extends PHPUnit_Framework_TestCase
public function testPassthrough()
{
$client = Client::getInstance();
- $client->setUrl('http://miniflux.net/favicon.ico');
+ $client->setUrl('https://miniflux.net/favicon.ico');
$client->enablePassthroughMode();
$client->execute();
diff --git a/vendor/fguillot/picofeed/tests/Client/CurlTest.php b/vendor/fguillot/picofeed/tests/Client/CurlTest.php
index 3ee249ff3..a1410ce72 100644
--- a/vendor/fguillot/picofeed/tests/Client/CurlTest.php
+++ b/vendor/fguillot/picofeed/tests/Client/CurlTest.php
@@ -28,7 +28,7 @@ class CurlTest extends PHPUnit_Framework_TestCase
public function testPassthrough()
{
$client = new Curl;
- $client->setUrl('http://miniflux.net/favicon.ico');
+ $client->setUrl('https://miniflux.net/favicon.ico');
$client->enablePassthroughMode();
$client->doRequest();
diff --git a/vendor/fguillot/picofeed/tests/Client/UrlTest.php b/vendor/fguillot/picofeed/tests/Client/UrlTest.php
index f55d301c0..e74e0c79d 100644
--- a/vendor/fguillot/picofeed/tests/Client/UrlTest.php
+++ b/vendor/fguillot/picofeed/tests/Client/UrlTest.php
@@ -288,5 +288,11 @@ AAAFCAYAAACNbyblAAAAHElEQVQI12P4//8/w38GIAXDIBKE0DHxgljNBAAO
'',
Url::resolve('', '')
);
+
+ // Test no-ascii paths
+ $this->assertEquals(
+ 'http://lesjoiesducode.fr/post/125336534020/quand-la-page-doit-%C3%AAtre-pixel-perfect',
+ Url::resolve('http://lesjoiesducode.fr/post/125336534020/quand-la-page-doit-ĂȘtre-pixel-perfect', 'http://lesjoiesducode.fr/post/125336534020')
+ );
}
}
diff --git a/vendor/fguillot/picofeed/tests/Syndication/Rss20WriterTest.php b/vendor/fguillot/picofeed/tests/Syndication/Rss20WriterTest.php
index 2c61b8537..8a7f945f9 100644
--- a/vendor/fguillot/picofeed/tests/Syndication/Rss20WriterTest.php
+++ b/vendor/fguillot/picofeed/tests/Syndication/Rss20WriterTest.php
@@ -50,7 +50,7 @@ class Rss20WriterTest extends PHPUnit_Framework_TestCase
<generator>PicoFeed (https://github.com/fguillot/picoFeed)</generator>
<title>My site</title>
<description>My site</description>
- <pubDate>'.date(DATE_RFC822).'</pubDate>
+ <pubDate>'.date(DATE_RSS).'</pubDate>
<atom:link href="http://boo/feed.atom" rel="self" type="application/rss+xml"/>
<link>http://boo/</link>
<webMaster>me@here (Me)</webMaster>
@@ -58,7 +58,7 @@ class Rss20WriterTest extends PHPUnit_Framework_TestCase
<title>My article 1</title>
<link>http://foo/bar</link>
<guid isPermaLink="true">http://foo/bar</guid>
- <pubDate>'.date(DATE_RFC822, strtotime('-2 days')).'</pubDate>
+ <pubDate>'.date(DATE_RSS, strtotime('-2 days')).'</pubDate>
<description>Super summary</description>
<content:encoded><![CDATA[<p>content</p>]]></content:encoded>
</item>
@@ -66,7 +66,7 @@ class Rss20WriterTest extends PHPUnit_Framework_TestCase
<title>My article 2</title>
<link>http://foo/bar2</link>
<guid isPermaLink="true">http://foo/bar2</guid>
- <pubDate>'.date(DATE_RFC822, strtotime('-1 day')).'</pubDate>
+ <pubDate>'.date(DATE_RSS, strtotime('-1 day')).'</pubDate>
<description>Super summary 2</description>
<content:encoded><![CDATA[<p>content 2 &nbsp; &copy; 2015</p>]]></content:encoded>
</item>
@@ -74,7 +74,7 @@ class Rss20WriterTest extends PHPUnit_Framework_TestCase
<title>My article 3</title>
<link>http://foo/bar3</link>
<guid isPermaLink="true">http://foo/bar3</guid>
- <pubDate>'.date(DATE_RFC822).'</pubDate>
+ <pubDate>'.date(DATE_RSS).'</pubDate>
</item>
</channel>
</rss>
@@ -82,4 +82,4 @@ class Rss20WriterTest extends PHPUnit_Framework_TestCase
$this->assertEquals($expected_output, $generated_output);
}
-} \ No newline at end of file
+}