When decompressing try to raw-inflate first, props dd32, fixes #11600

git-svn-id: http://svn.automattic.com/wordpress/trunk@12642 1a063a9b-81f0-0310-95a4-ce76da25c4cd
This commit is contained in:
azaozz 2010-01-07 10:26:33 +00:00
parent c30c392e91
commit 36b2df4606

View File

@ -1816,18 +1816,18 @@ class WP_Http_Encoding {
* @return string|bool False on failure.
*/
function decompress( $compressed, $length = null ) {
$decompressed = WP_Http_Encoding::compatible_gzinflate( $compressed );
if ( false !== $decompressed )
if ( false !== ( $decompressed = @gzinflate( $compressed ) ) )
return $decompressed;
$decompressed = gzuncompress( $compressed );
if ( false !== ( $decompressed = WP_Http_Encoding::compatible_gzinflate( $compressed ) ) )
return $decompressed;
if ( false !== $decompressed )
if ( false !== ( $decompressed = @gzuncompress( $compressed ) ) )
return $decompressed;
if ( function_exists('gzdecode') ) {
$decompressed = gzdecode( $compressed );
$decompressed = @gzdecode( $compressed );
if ( false !== $decompressed )
return $decompressed;
@ -1916,7 +1916,7 @@ class WP_Http_Encoding {
if ( is_array( $headers ) ) {
if ( array_key_exists('content-encoding', $headers) && ! empty( $headers['content-encoding'] ) )
return true;
} else if( is_string( $headers ) ) {
} else if ( is_string( $headers ) ) {
return ( stripos($headers, 'content-encoding:') !== false );
}