From 79862f61b4655c1aa2b2b4ad6778766e67ca151c Mon Sep 17 00:00:00 2001 From: Frederic Guillot Date: Sun, 1 Feb 2015 14:48:05 -0500 Subject: [PATCH] Update vendor --- vendor/autoload.php | 2 +- vendor/composer/autoload_real.php | 10 +-- vendor/composer/installed.json | 86 +++++++++---------- .../picofarad/lib/PicoFarad/Response.php | 2 +- .../picofeed/lib/PicoFeed/Client/Client.php | 77 +---------------- .../picofeed/lib/PicoFeed/Client/Curl.php | 74 ++++++++++++++++ .../lib/PicoFeed/Client/HttpHeaders.php | 3 +- .../picofeed/lib/PicoFeed/Client/Stream.php | 36 +++++--- .../picofeed/tests/Client/CurlTest.php | 7 +- .../picofeed/tests/Client/StreamTest.php | 6 +- .../picofeed/tests/Parser/DateParserTest.php | 20 ++--- .../picofeed/tests/Parser/Rss20ParserTest.php | 2 +- .../picofeed/tests/Parser/Rss91ParserTest.php | 4 +- .../picofeed/tests/Parser/Rss92ParserTest.php | 2 +- 14 files changed, 171 insertions(+), 160 deletions(-) diff --git a/vendor/autoload.php b/vendor/autoload.php index 1126cb5..137c51e 100644 --- a/vendor/autoload.php +++ b/vendor/autoload.php @@ -4,4 +4,4 @@ require_once __DIR__ . '/composer' . '/autoload_real.php'; -return ComposerAutoloaderInit5f8b99c769a3ccbc962bd7a5595128da::getLoader(); +return ComposerAutoloaderInit08690efdd2fbfd1e6b9f9841af6f8e3c::getLoader(); diff --git a/vendor/composer/autoload_real.php b/vendor/composer/autoload_real.php index 665e15a..908752b 100644 --- a/vendor/composer/autoload_real.php +++ b/vendor/composer/autoload_real.php @@ -2,7 +2,7 @@ // autoload_real.php @generated by Composer -class ComposerAutoloaderInit5f8b99c769a3ccbc962bd7a5595128da +class ComposerAutoloaderInit08690efdd2fbfd1e6b9f9841af6f8e3c { private static $loader; @@ -19,9 +19,9 @@ class ComposerAutoloaderInit5f8b99c769a3ccbc962bd7a5595128da return self::$loader; } - spl_autoload_register(array('ComposerAutoloaderInit5f8b99c769a3ccbc962bd7a5595128da', 'loadClassLoader'), true, true); + spl_autoload_register(array('ComposerAutoloaderInit08690efdd2fbfd1e6b9f9841af6f8e3c', 'loadClassLoader'), true, true); self::$loader = $loader = new \Composer\Autoload\ClassLoader(); - spl_autoload_unregister(array('ComposerAutoloaderInit5f8b99c769a3ccbc962bd7a5595128da', 'loadClassLoader')); + spl_autoload_unregister(array('ComposerAutoloaderInit08690efdd2fbfd1e6b9f9841af6f8e3c', 'loadClassLoader')); $map = require __DIR__ . '/autoload_namespaces.php'; foreach ($map as $namespace => $path) { @@ -42,14 +42,14 @@ class ComposerAutoloaderInit5f8b99c769a3ccbc962bd7a5595128da $includeFiles = require __DIR__ . '/autoload_files.php'; foreach ($includeFiles as $file) { - composerRequire5f8b99c769a3ccbc962bd7a5595128da($file); + composerRequire08690efdd2fbfd1e6b9f9841af6f8e3c($file); } return $loader; } } -function composerRequire5f8b99c769a3ccbc962bd7a5595128da($file) +function composerRequire08690efdd2fbfd1e6b9f9841af6f8e3c($file) { require $file; } diff --git a/vendor/composer/installed.json b/vendor/composer/installed.json index 45e85ea..9a24344 100644 --- a/vendor/composer/installed.json +++ b/vendor/composer/installed.json @@ -1,43 +1,4 @@ [ - { - "name": "fguillot/picofarad", - "version": "dev-master", - "version_normalized": "9999999-dev", - "source": { - "type": "git", - "url": "https://github.com/fguillot/picoFarad.git", - "reference": "749506cd204ae05c3cc8894be1b4302b4aed6e53" - }, - "dist": { - "type": "zip", - "url": "https://api.github.com/repos/fguillot/picoFarad/zipball/749506cd204ae05c3cc8894be1b4302b4aed6e53", - "reference": "749506cd204ae05c3cc8894be1b4302b4aed6e53", - "shasum": "" - }, - "require": { - "php": ">=5.3.0" - }, - "time": "2015-01-17 23:58:31", - "type": "library", - "installation-source": "dist", - "autoload": { - "psr-0": { - "PicoFarad": "lib/" - } - }, - "notification-url": "https://packagist.org/downloads/", - "license": [ - "Unlicense" - ], - "authors": [ - { - "name": "Frédéric Guillot", - "homepage": "http://fredericguillot.com" - } - ], - "description": "Minimalist micro-framework", - "homepage": "https://github.com/fguillot/picoFarad" - }, { "name": "fguillot/json-rpc", "version": "dev-master", @@ -155,6 +116,45 @@ "description": "Minimalist database query builder", "homepage": "https://github.com/fguillot/picoDb" }, + { + "name": "fguillot/picofarad", + "version": "dev-master", + "version_normalized": "9999999-dev", + "source": { + "type": "git", + "url": "https://github.com/fguillot/picoFarad.git", + "reference": "1bc48a4367adf359f3439c2e0ae20a7d299d8ccd" + }, + "dist": { + "type": "zip", + "url": "https://api.github.com/repos/fguillot/picoFarad/zipball/1bc48a4367adf359f3439c2e0ae20a7d299d8ccd", + "reference": "1bc48a4367adf359f3439c2e0ae20a7d299d8ccd", + "shasum": "" + }, + "require": { + "php": ">=5.3.0" + }, + "time": "2015-02-01 19:40:13", + "type": "library", + "installation-source": "dist", + "autoload": { + "psr-0": { + "PicoFarad": "lib/" + } + }, + "notification-url": "https://packagist.org/downloads/", + "license": [ + "Unlicense" + ], + "authors": [ + { + "name": "Frédéric Guillot", + "homepage": "http://fredericguillot.com" + } + ], + "description": "Minimalist micro-framework", + "homepage": "https://github.com/fguillot/picoFarad" + }, { "name": "fguillot/picofeed", "version": "dev-master", @@ -162,12 +162,12 @@ "source": { "type": "git", "url": "https://github.com/fguillot/picoFeed.git", - "reference": "9253c3d5ff1148a5175bf24633b73725832437c8" + "reference": "7f45ed03621778b30db0ff89a09f98d67096c253" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/fguillot/picoFeed/zipball/9253c3d5ff1148a5175bf24633b73725832437c8", - "reference": "9253c3d5ff1148a5175bf24633b73725832437c8", + "url": "https://api.github.com/repos/fguillot/picoFeed/zipball/7f45ed03621778b30db0ff89a09f98d67096c253", + "reference": "7f45ed03621778b30db0ff89a09f98d67096c253", "shasum": "" }, "require": { @@ -178,7 +178,7 @@ "ext-xml": "*", "php": ">=5.3.0" }, - "time": "2015-01-29 02:00:49", + "time": "2015-01-31 22:07:02", "type": "library", "installation-source": "dist", "autoload": { diff --git a/vendor/fguillot/picofarad/lib/PicoFarad/Response.php b/vendor/fguillot/picofarad/lib/PicoFarad/Response.php index 27eafd0..dc2c5eb 100644 --- a/vendor/fguillot/picofarad/lib/PicoFarad/Response.php +++ b/vendor/fguillot/picofarad/lib/PicoFarad/Response.php @@ -123,7 +123,7 @@ function csp(array $policies = array()) foreach ($hosts as &$host) { - if ($host === '*' || $host === 'self' || strpos($host, 'http') === 0) { + if ($host === '*' || $host === "'self'" || strpos($host, 'http') === 0) { $acl .= $host.' '; } } diff --git a/vendor/fguillot/picofeed/lib/PicoFeed/Client/Client.php b/vendor/fguillot/picofeed/lib/PicoFeed/Client/Client.php index 55d2c56..9f358a6 100644 --- a/vendor/fguillot/picofeed/lib/PicoFeed/Client/Client.php +++ b/vendor/fguillot/picofeed/lib/PicoFeed/Client/Client.php @@ -157,47 +157,14 @@ abstract class Client */ protected $status_code = 0; - /** - * HTTP response body - * - * @access protected - * @var string - */ - protected $body = ''; - - /** - * Body size - * - * @access protected - * @var integer - */ - protected $body_length = 0; - - /** - * HTTP response headers - * - * @access protected - * @var array - */ - protected $headers = array(); - - /** - * Counter on the number of header received - * - * @access protected - * @var integer - */ - protected $headers_counter = 0; - /** * Do the HTTP request * * @abstract * @access public - * @param bool $follow_location Flag used when there is an open_basedir restriction * @return array */ - abstract public function doRequest($follow_location = true); + abstract public function doRequest(); /** * Get client instance: curl or stream driver @@ -295,48 +262,6 @@ abstract class Client } } - /** - * Handle manually redirections when there is an open base dir restriction - * - * @access private - * @param string $location Redirected URL - * @return array - */ - public function handleRedirection($location) - { - $nb_redirects = 0; - $result = array(); - $this->url = Url::resolve($location, $this->url); - $this->body = ''; - $this->body_length = 0; - $this->headers = array(); - $this->headers_counter = 0; - - while (true) { - - $nb_redirects++; - - if ($nb_redirects >= $this->max_redirects) { - throw new MaxRedirectException('Maximum number of redirections reached'); - } - - $result = $this->doRequest(false); - - if ($result['status'] == 301 || $result['status'] == 302) { - $this->url = $result['headers']['Location']; - $this->body = ''; - $this->body_length = 0; - $this->headers = array(); - $this->headers_counter = 0; - } - else { - break; - } - } - - return $result; - } - /** * Check if a request has been modified according to the parameters * diff --git a/vendor/fguillot/picofeed/lib/PicoFeed/Client/Curl.php b/vendor/fguillot/picofeed/lib/PicoFeed/Client/Curl.php index d45773d..f358c3f 100644 --- a/vendor/fguillot/picofeed/lib/PicoFeed/Client/Curl.php +++ b/vendor/fguillot/picofeed/lib/PicoFeed/Client/Curl.php @@ -12,6 +12,38 @@ use PicoFeed\Logging\Logger; */ class Curl extends Client { + /** + * HTTP response body + * + * @access private + * @var string + */ + private $body = ''; + + /** + * Body size + * + * @access private + * @var integer + */ + private $body_length = 0; + + /** + * HTTP response headers + * + * @access private + * @var array + */ + private $headers = array(); + + /** + * Counter on the number of header received + * + * @access private + * @var integer + */ + private $headers_counter = 0; + /** * cURL callback to read the HTTP body * @@ -228,6 +260,48 @@ class Curl extends Client return $follow_location && ini_get('open_basedir') !== '' && ($status == 301 || $status == 302); } + /** + * Handle manually redirections when there is an open base dir restriction + * + * @access private + * @param string $location Redirected URL + * @return array + */ + private function handleRedirection($location) + { + $nb_redirects = 0; + $result = array(); + $this->url = Url::resolve($location, $this->url); + $this->body = ''; + $this->body_length = 0; + $this->headers = array(); + $this->headers_counter = 0; + + while (true) { + + $nb_redirects++; + + if ($nb_redirects >= $this->max_redirects) { + throw new MaxRedirectException('Maximum number of redirections reached'); + } + + $result = $this->doRequest(false); + + if ($result['status'] == 301 || $result['status'] == 302) { + $this->url = Url::resolve($result['headers']['Location'], $this->url); + $this->body = ''; + $this->body_length = 0; + $this->headers = array(); + $this->headers_counter = 0; + } + else { + break; + } + } + + return $result; + } + /** * Handle cURL errors (throw individual exceptions) * diff --git a/vendor/fguillot/picofeed/lib/PicoFeed/Client/HttpHeaders.php b/vendor/fguillot/picofeed/lib/PicoFeed/Client/HttpHeaders.php index cde8f75..ccced5f 100644 --- a/vendor/fguillot/picofeed/lib/PicoFeed/Client/HttpHeaders.php +++ b/vendor/fguillot/picofeed/lib/PicoFeed/Client/HttpHeaders.php @@ -53,12 +53,13 @@ class HttpHeaders implements ArrayAccess */ public static function parse(array $lines) { - $status = 200; + $status = 0; $headers = array(); foreach ($lines as $line) { if (strpos($line, 'HTTP') === 0) { + $headers = array(); $status = (int) substr($line, 9, 3); } else if (strpos($line, ':') !== false) { diff --git a/vendor/fguillot/picofeed/lib/PicoFeed/Client/Stream.php b/vendor/fguillot/picofeed/lib/PicoFeed/Client/Stream.php index b80e731..d20423d 100644 --- a/vendor/fguillot/picofeed/lib/PicoFeed/Client/Stream.php +++ b/vendor/fguillot/picofeed/lib/PicoFeed/Client/Stream.php @@ -48,6 +48,23 @@ class Stream extends Client return $headers; } + /** + * Construct the final URL from location headers + * + * @access private + * @param array $headers List of HTTP response header + */ + private function setEffectiveUrl($headers) + { + foreach($headers as $header) { + if (stripos($header, 'Location') === 0) { + list($name, $value) = explode(': ', $header); + + $this->url = Url::resolve($value, $this->url); + } + } + } + /** * Prepare stream context * @@ -61,7 +78,7 @@ class Stream extends Client 'method' => 'GET', 'protocol_version' => 1.1, 'timeout' => $this->timeout, - 'follow_location' => 0, + 'max_redirects' => $this->max_redirects, ) ); @@ -89,10 +106,9 @@ class Stream extends Client * Do the HTTP request * * @access public - * @param bool $follow_location Flag used when there is an open_basedir restriction - * @return array HTTP response ['body' => ..., 'status' => ..., 'headers' => ...] + * @return array HTTP response ['body' => ..., 'status' => ..., 'headers' => ...] */ - public function doRequest($follow_location = false) + public function doRequest() { // Create context $context = stream_context_create($this->prepareContext()); @@ -114,20 +130,16 @@ class Stream extends Client // Get HTTP headers response $metadata = stream_get_meta_data($stream); + fclose($stream); + if ($metadata['timed_out']) { throw new TimeoutException('Operation timeout'); } + $this->setEffectiveUrl($metadata['wrapper_data']); + list($status, $headers) = HttpHeaders::parse($metadata['wrapper_data']); - fclose($stream); - - // Do redirect manual to get only the headers of the last request and - // the final url - if ($status == 301 || $status == 302) { - return $this->handleRedirection($headers['Location']); - } - return array( 'status' => $status, 'body' => $this->decodeBody($body, $headers), diff --git a/vendor/fguillot/picofeed/tests/Client/CurlTest.php b/vendor/fguillot/picofeed/tests/Client/CurlTest.php index 4509dbc..779031c 100644 --- a/vendor/fguillot/picofeed/tests/Client/CurlTest.php +++ b/vendor/fguillot/picofeed/tests/Client/CurlTest.php @@ -18,18 +18,17 @@ class CurlTest extends PHPUnit_Framework_TestCase $this->assertEquals('text/html; charset=utf-8', $result['headers']['Content-Type']); } - public function testRedirect() { $client = new Curl; - $client->setUrl('http://www.miniflux.net/index.html'); + $client->setUrl('http://rss.feedsportal.com/c/629/f/502199/s/42e50391/sc/44/l/0L0S0A1net0N0Ceditorial0C6437220Candroid0Egoogle0Enow0Es0Eouvre0Eaux0Eapplications0Etierces0C0T0Dxtor0FRSS0E16/story01.htm'); $result = $client->doRequest(); $this->assertTrue(is_array($result)); $this->assertEquals(200, $result['status']); $this->assertEquals('assertEquals('text/html; charset=utf-8', $result['headers']['Content-Type']); - $this->assertEquals('http://miniflux.net/', $client->getUrl()); + $this->assertEquals('text/html', $result['headers']['Content-Type']); + $this->assertEquals('http://www.01net.com/editorial/643722/android-google-now-s-ouvre-aux-applications-tierces/', str_replace('#?xtor=RSS-16', '', $client->getUrl())); } /** diff --git a/vendor/fguillot/picofeed/tests/Client/StreamTest.php b/vendor/fguillot/picofeed/tests/Client/StreamTest.php index 91f52c8..9084de8 100644 --- a/vendor/fguillot/picofeed/tests/Client/StreamTest.php +++ b/vendor/fguillot/picofeed/tests/Client/StreamTest.php @@ -30,14 +30,14 @@ class StreamTest extends PHPUnit_Framework_TestCase public function testRedirect() { $client = new Stream; - $client->setUrl('http://www.miniflux.net/index.html'); + $client->setUrl('http://rss.feedsportal.com/c/629/f/502199/s/42e50391/sc/44/l/0L0S0A1net0N0Ceditorial0C6437220Candroid0Egoogle0Enow0Es0Eouvre0Eaux0Eapplications0Etierces0C0T0Dxtor0FRSS0E16/story01.htm'); $result = $client->doRequest(); $this->assertTrue(is_array($result)); $this->assertEquals(200, $result['status']); $this->assertEquals('assertEquals('text/html; charset=utf-8', $result['headers']['Content-Type']); - $this->assertEquals('http://miniflux.net/', $client->getUrl()); + $this->assertEquals('text/html', $result['headers']['Content-Type']); + $this->assertEquals('http://www.01net.com/editorial/643722/android-google-now-s-ouvre-aux-applications-tierces/#?xtor=RSS-16', $client->getUrl()); } /** diff --git a/vendor/fguillot/picofeed/tests/Parser/DateParserTest.php b/vendor/fguillot/picofeed/tests/Parser/DateParserTest.php index 2f8a41d..6ad464b 100644 --- a/vendor/fguillot/picofeed/tests/Parser/DateParserTest.php +++ b/vendor/fguillot/picofeed/tests/Parser/DateParserTest.php @@ -32,17 +32,17 @@ class DateParserTest extends PHPUnit_Framework_TestCase $this->assertEquals('2010-08-20', date('Y-m-d', $parser->getTimestamp('2010-08-20Thh:08:ssZ'))); $this->assertEquals(1288648057, $parser->getTimestamp('Mon, 01 Nov 2010 21:47:37 UT')); $this->assertEquals(1346069615, $parser->getTimestamp('Mon Aug 27 2012 12:13:35 GMT-0700 (PDT)')); - $this->assertEquals(time(), $parser->getTimestamp('Tue, 3 Febuary 2010 00:00:00 IST'), 1); - $this->assertEquals(time(), $parser->getTimestamp('############# EST'), 1); - $this->assertEquals(time(), $parser->getTimestamp('Wed, 30 Nov -0001 00:00:00 +0000'), 1); - $this->assertEquals(time(), $parser->getTimestamp('čet, 24 maj 2012 00:00:00'), 1); - $this->assertEquals(time(), $parser->getTimestamp('-0-0T::Z'), 1); - $this->assertEquals(time(), $parser->getTimestamp('Wed, 18 2012'), 1); - $this->assertEquals(time(), $parser->getTimestamp("'2009-09-30 CDT16:09:54"), 1); - $this->assertEquals(time(), $parser->getTimestamp('ary 8 Jan 2013 00:00:00 GMT'), 1); - $this->assertEquals(time(), $parser->getTimestamp('Sat, 11 00:00:01 GMT'), 1); + $this->assertEquals(time(), $parser->getTimestamp('Tue, 3 Febuary 2010 00:00:00 IST'), '', 1); + $this->assertEquals(time(), $parser->getTimestamp('############# EST'), '', 1); + $this->assertEquals(time(), $parser->getTimestamp('Wed, 30 Nov -0001 00:00:00 +0000'), '', 1); + $this->assertEquals(time(), $parser->getTimestamp('čet, 24 maj 2012 00:00:00'), '', 1); + $this->assertEquals(time(), $parser->getTimestamp('-0-0T::Z'), '', 1); + $this->assertEquals(time(), $parser->getTimestamp('Wed, 18 2012'), '', 1); + $this->assertEquals(time(), $parser->getTimestamp("'2009-09-30 CDT16:09:54"), '', 1); + $this->assertEquals(time(), $parser->getTimestamp('ary 8 Jan 2013 00:00:00 GMT'), '', 1); + $this->assertEquals(time(), $parser->getTimestamp('Sat, 11 00:00:01 GMT'), '', 1); $this->assertEquals(1370631743, $parser->getTimestamp('Fri Jun 07 2013 19:02:23 GMT+0000 (UTC)')); $this->assertEquals(1377412225, $parser->getTimestamp('25/08/2013 06:30:25 م')); - $this->assertEquals(time(), $parser->getTimestamp('+0400'),1); + $this->assertEquals(time(), $parser->getTimestamp('+0400'), '', 1); } } diff --git a/vendor/fguillot/picofeed/tests/Parser/Rss20ParserTest.php b/vendor/fguillot/picofeed/tests/Parser/Rss20ParserTest.php index 1850e63..344917d 100644 --- a/vendor/fguillot/picofeed/tests/Parser/Rss20ParserTest.php +++ b/vendor/fguillot/picofeed/tests/Parser/Rss20ParserTest.php @@ -93,7 +93,7 @@ class Rss20ParserTest extends PHPUnit_Framework_TestCase $parser = new Rss20(file_get_contents('tests/fixtures/fulltextrss.xml')); $feed = $parser->execute(); - $this->assertEquals(time(), $feed->getDate(), 1); + $this->assertEquals(time(), $feed->getDate(), '', 1); } public function testFeedLanguage() diff --git a/vendor/fguillot/picofeed/tests/Parser/Rss91ParserTest.php b/vendor/fguillot/picofeed/tests/Parser/Rss91ParserTest.php index 31d8c3a..111f449 100644 --- a/vendor/fguillot/picofeed/tests/Parser/Rss91ParserTest.php +++ b/vendor/fguillot/picofeed/tests/Parser/Rss91ParserTest.php @@ -18,13 +18,13 @@ class Rss91ParserTest extends PHPUnit_Framework_TestCase $this->assertEquals('', $feed->getFeedUrl()); $this->assertEquals('http://writetheweb.com/', $feed->getSiteUrl()); $this->assertEquals('http://writetheweb.com/', $feed->getId()); - $this->assertEquals(time(), $feed->getDate(), 1); + $this->assertEquals(time(), $feed->getDate(), '', 1); $this->assertEquals(6, count($feed->items)); $this->assertEquals('Giving the world a pluggable Gnutella', $feed->items[0]->getTitle()); $this->assertEquals('http://writetheweb.com/read.php?item=24', $feed->items[0]->getUrl()); $this->assertEquals('085a9133a75542f878fa73ee2afbb6a2350b6c4fb125e6d8ca09478c47702111', $feed->items[0]->getId()); - $this->assertEquals(time(), $feed->items[0]->getDate(), 1); + $this->assertEquals(time(), $feed->items[0]->getDate(), '', 1); $this->assertEquals('webmaster@writetheweb.com', $feed->items[0]->getAuthor()); $this->assertTrue(strpos($feed->items[1]->getContent(), '

After a period of dormancy') === 0); } diff --git a/vendor/fguillot/picofeed/tests/Parser/Rss92ParserTest.php b/vendor/fguillot/picofeed/tests/Parser/Rss92ParserTest.php index cf33147..d5358dd 100644 --- a/vendor/fguillot/picofeed/tests/Parser/Rss92ParserTest.php +++ b/vendor/fguillot/picofeed/tests/Parser/Rss92ParserTest.php @@ -18,7 +18,7 @@ class Rss92ParserTest extends PHPUnit_Framework_TestCase $this->assertEquals('', $feed->getFeedUrl()); $this->assertEquals('http://www.universfreebox.com/', $feed->getSiteUrl()); $this->assertEquals('http://www.universfreebox.com/', $feed->getId()); - $this->assertEquals(time(), $feed->date, 1); + $this->assertEquals(time(), $feed->date, '', 1); $this->assertEquals(30, count($feed->items)); $this->assertEquals('Retour de Xavier Niel sur Twitter, « sans initiative privée, pas de révolution #Born2code »', $feed->items[0]->title);