Add inflation support for java.util.zip.Deflater in WP_Http_Encoding::compatible_gzinflate(). Fixes #18273
git-svn-id: http://svn.automattic.com/wordpress/trunk@18718 1a063a9b-81f0-0310-95a4-ce76da25c4cd
This commit is contained in:
parent
5eef6313ef
commit
f40bc45b6f
|
@ -1636,6 +1636,8 @@ class WP_Http_Encoding {
|
|||
* @return string|bool False on failure.
|
||||
*/
|
||||
function compatible_gzinflate($gzData) {
|
||||
|
||||
// Compressed data might contain a full header, if so strip it for gzinflate()
|
||||
if ( substr($gzData, 0, 3) == "\x1f\x8b\x08" ) {
|
||||
$i = 10;
|
||||
$flg = ord( substr($gzData, 3, 1) );
|
||||
|
@ -1651,10 +1653,17 @@ class WP_Http_Encoding {
|
|||
if ( $flg & 2 )
|
||||
$i = $i + 2;
|
||||
}
|
||||
return gzinflate( substr($gzData, $i, -8) );
|
||||
} else {
|
||||
return false;
|
||||
$decompressed = @gzinflate( substr($gzData, $i, -8) );
|
||||
if ( false !== $decompressed )
|
||||
return $decompressed;
|
||||
}
|
||||
|
||||
// Compressed data from java.util.zip.Deflater amongst others.
|
||||
$decompressed = @gzinflate( substr($gzData, 2) );
|
||||
if ( false !== $decompressed )
|
||||
return $decompressed;
|
||||
|
||||
return false;
|
||||
}
|
||||
|
||||
/**
|
||||
|
|
Loading…
Reference in New Issue