X-Git-Url: https://git.immae.eu/?a=blobdiff_plain;f=inc%2F3rdparty%2Flibraries%2Fsimplepie%2Flibrary%2FSimplePie%2FHTTP%2FParser.php;fp=inc%2F3rdparty%2Fsimplepie%2FSimplePie%2FHTTP%2FParser.php;h=bff2222b2c789469167ce4f22acac667001a3781;hb=42c80841c846610be280218d53fcde06b0f0063b;hp=cc9660c68112dd100a82fe1512e590b774efb16e;hpb=59cc585271a5f253b15617d97e26a29403a929dc;p=github%2Fwallabag%2Fwallabag.git diff --git a/inc/3rdparty/simplepie/SimplePie/HTTP/Parser.php b/inc/3rdparty/libraries/simplepie/library/SimplePie/HTTP/Parser.php similarity index 94% rename from inc/3rdparty/simplepie/SimplePie/HTTP/Parser.php rename to inc/3rdparty/libraries/simplepie/library/SimplePie/HTTP/Parser.php index cc9660c6..bff2222b 100644 --- a/inc/3rdparty/simplepie/SimplePie/HTTP/Parser.php +++ b/inc/3rdparty/libraries/simplepie/library/SimplePie/HTTP/Parser.php @@ -5,7 +5,7 @@ * A PHP-Based RSS and Atom Feed Framework. * Takes the hard work out of managing a complete RSS/Atom solution. * - * Copyright (c) 2004-2009, Ryan Parman, Geoffrey Sneddon, Ryan McCue, and contributors + * Copyright (c) 2004-2012, Ryan Parman, Geoffrey Sneddon, Ryan McCue, and contributors * All rights reserved. * * Redistribution and use in source and binary forms, with or without modification, are @@ -33,14 +33,13 @@ * POSSIBILITY OF SUCH DAMAGE. * * @package SimplePie - * @version 1.3-dev - * @copyright 2004-2010 Ryan Parman, Geoffrey Sneddon, Ryan McCue + * @version 1.3.1 + * @copyright 2004-2012 Ryan Parman, Geoffrey Sneddon, Ryan McCue * @author Ryan Parman * @author Geoffrey Sneddon * @author Ryan McCue * @link http://simplepie.org/ SimplePie * @license http://www.opensource.org/licenses/bsd-license.php BSD License - * @todo phpDoc comments */ @@ -48,6 +47,7 @@ * HTTP Response Parser * * @package SimplePie + * @subpackage HTTP */ class SimplePie_HTTP_Parser { @@ -457,7 +457,7 @@ class SimplePie_HTTP_Parser */ protected function chunked() { - if (!preg_match('/^[0-9a-f]+(\s|\r|\n)+/mi', trim($this->body))) + if (!preg_match('/^([0-9a-f]+)[^\r\n]*\r\n/i', trim($this->body))) { $this->state = 'emit'; return; @@ -468,7 +468,7 @@ class SimplePie_HTTP_Parser while (true) { - $is_chunked = (bool) preg_match( '/^([0-9a-f]+)(\s|\r|\n)+/mi', $encoded, $matches ); + $is_chunked = (bool) preg_match( '/^([0-9a-f]+)[^\r\n]*\r\n/i', $encoded, $matches ); if (!$is_chunked) { // Looks like it's not chunked after all @@ -476,12 +476,20 @@ class SimplePie_HTTP_Parser return; } - $length = hexdec($matches[1]); + $length = hexdec(trim($matches[1])); + if ($length === 0) + { + // Ignore trailer headers + $this->state = 'emit'; + $this->body = $decoded; + return; + } + $chunk_length = strlen($matches[0]); $decoded .= $part = substr($encoded, $chunk_length, $length); - $encoded = ltrim(substr($encoded, $chunk_length + $length), "\r\n"); + $encoded = substr($encoded, $chunk_length + $length + 2); - if (trim($encoded) === '0') + if (trim($encoded) === '0' || empty($encoded)) { $this->state = 'emit'; $this->body = $decoded;