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.
|
* @return string|bool False on failure.
|
||||||
*/
|
*/
|
||||||
function compatible_gzinflate($gzData) {
|
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" ) {
|
if ( substr($gzData, 0, 3) == "\x1f\x8b\x08" ) {
|
||||||
$i = 10;
|
$i = 10;
|
||||||
$flg = ord( substr($gzData, 3, 1) );
|
$flg = ord( substr($gzData, 3, 1) );
|
||||||
|
@ -1651,10 +1653,17 @@ class WP_Http_Encoding {
|
||||||
if ( $flg & 2 )
|
if ( $flg & 2 )
|
||||||
$i = $i + 2;
|
$i = $i + 2;
|
||||||
}
|
}
|
||||||
return gzinflate( substr($gzData, $i, -8) );
|
$decompressed = @gzinflate( substr($gzData, $i, -8) );
|
||||||
} else {
|
if ( false !== $decompressed )
|
||||||
return false;
|
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