Ticket #8618: 8618.2.diff
File 8618.2.diff, 1.2 KB (added by , 16 years ago) |
---|
-
http.php
412 412 * @static 413 413 * 414 414 * @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. 416 416 */ 417 417 function chunkTransferDecode($body) { 418 418 $body = str_replace(array("\r\n", "\r"), "\n", $body); … … 423 423 $parsedBody = ''; 424 424 //$parsedHeaders = array(); Unsupported 425 425 426 $done = false; 427 428 do { 426 while ( true ) { 429 427 $hasChunk = (bool) preg_match( '/^([0-9a-f]+)(\s|\n)+/mi', $body, $match ); 430 428 431 429 if ( $hasChunk ) { 432 if ( empty( $match[1]) ) {430 if ( empty( $match[1] ) ) 433 431 return $body; 434 }435 432 436 433 $length = hexdec( $match[1] ); 437 434 $chunkLength = strlen( $match[0] ); … … 441 438 442 439 $body = ltrim(str_replace(array($match[0], $strBody), '', $body), "\n"); 443 440 444 if( "0" == trim($body) ) { 445 $done = true; 441 if( "0" == trim($body) ) 446 442 return $parsedBody; // Ignore footer headers. 447 break;448 }449 443 } else { 450 444 return $body; 451 445 } 452 } while ( true === $done );446 } 453 447 } 454 448 } 455 449