Make WordPress Core

Changeset 10283


Ignore:
Timestamp:
12/31/2008 03:02:53 AM (18 years ago)
Author:
ryan
Message:

Chunked decoding fix from jacobsantos. fixes #8618

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/wp-includes/http.php

    r10282 r10283  
    413413         *
    414414         * @param string $body Body content
    415          * @return bool|string|WP_Error False if not chunked encoded. WP_Error on failure. Chunked decoded body on success.
     415         * @return string Chunked decoded body on success or raw body on failure.
    416416         */
    417417        function chunkTransferDecode($body) {
     
    424424                //$parsedHeaders = array(); Unsupported
    425425
    426                 $done = false;
    427 
    428                 do {
     426                while ( true ) {
    429427                        $hasChunk = (bool) preg_match( '/^([0-9a-f]+)(\s|\n)+/mi', $body, $match );
    430428
    431429                        if ( $hasChunk ) {
    432                                 if ( empty($match[1]) ) {
     430                                if ( empty( $match[1] ) )
    433431                                        return $body;
    434                                 }
    435432
    436433                                $length = hexdec( $match[1] );
     
    442439                                $body = ltrim(str_replace(array($match[0], $strBody), '', $body), "\n");
    443440
    444                                 if( "0" == trim($body) ) {
    445                                         $done = true;
     441                                if( "0" == trim($body) )
    446442                                        return $parsedBody; // Ignore footer headers.
    447                                         break;
    448                                 }
    449443                        } else {
    450444                                return $body;
    451445                        }
    452                 } while ( true === $done );
     446                }
    453447        }
    454448}
Note: See TracChangeset for help on using the changeset viewer.