WordPress 4.6.2
[autoinstalls/wordpress.git] / wp-includes / class-requests.php
index 5a6257a8ac248acb7eabcfe7318699074233d8aa..bb266189c19c7bd498d548e214a48725afc4e64a 100644 (file)
@@ -749,15 +749,17 @@ class Requests {
         * @return string Decoded body
         */
        protected static function decode_chunked($data) {
-               if (!preg_match('/^([0-9a-f]+)[^\r\n]*\r\n/i', trim($data))) {
+               if (!preg_match('/^([0-9a-f]+)(?:;(?:[\w-]*)(?:=(?:(?:[\w-]*)*|"(?:[^\r\n])*"))?)*\r\n/i', trim($data))) {
                        return $data;
                }
 
+
+
                $decoded = '';
                $encoded = $data;
 
                while (true) {
-                       $is_chunked = (bool) preg_match('/^([0-9a-f]+)[^\r\n]*\r\n/i', $encoded, $matches);
+                       $is_chunked = (bool) preg_match('/^([0-9a-f]+)(?:;(?:[\w-]*)(?:=(?:(?:[\w-]*)*|"(?:[^\r\n])*"))?)*\r\n/i', $encoded, $matches);
                        if (!$is_chunked) {
                                // Looks like it's not chunked after all
                                return $data;