Fix raw_response code in Streams transport. Props jacobsantos. fixes #8476
git-svn-id: https://develop.svn.wordpress.org/trunk@10117 602fd350-edb4-49c9-b593-d223f7449a82
This commit is contained in:
parent
1d11d269e3
commit
9a7e2fc242
@ -396,7 +396,7 @@ class WP_Http {
|
||||
$body = str_replace(array("\r\n", "\r"), "\n", $body);
|
||||
// The body is not chunked encoding or is malformed.
|
||||
if ( ! preg_match( '/^[0-9a-f]+(\s|\n)+/mi', trim($body) ) )
|
||||
return false;
|
||||
return $body;
|
||||
|
||||
$parsedBody = '';
|
||||
//$parsedHeaders = array(); Unsupported
|
||||
@ -672,7 +672,11 @@ class WP_Http_Fopen {
|
||||
if ( function_exists('stream_get_meta_data') ) {
|
||||
$meta = stream_get_meta_data($handle);
|
||||
$theHeaders = $meta['wrapper_data'];
|
||||
if( isset( $meta['wrapper_data']['headers'] ) )
|
||||
$theHeaders = $meta['wrapper_data']['headers'];
|
||||
} else {
|
||||
if( ! isset( $http_response_header ) )
|
||||
global $http_response_header;
|
||||
$theHeaders = $http_response_header;
|
||||
}
|
||||
|
||||
@ -793,6 +797,11 @@ class WP_Http_Streams {
|
||||
|
||||
$strResponse = stream_get_contents($handle);
|
||||
$meta = stream_get_meta_data($handle);
|
||||
|
||||
$processedHeaders = array();
|
||||
if( isset( $meta['wrapper_data']['headers'] ) )
|
||||
$processedHeaders = WP_Http::processHeaders($meta['wrapper_data']['headers']);
|
||||
else
|
||||
$processedHeaders = WP_Http::processHeaders($meta['wrapper_data']);
|
||||
|
||||
if ( ! empty( $strResponse ) && isset( $processedHeaders['headers']['transfer-encoding'] ) && 'chunked' == $processedHeaders['headers']['transfer-encoding'] )
|
||||
|
Loading…
Reference in New Issue
Block a user