Add inflation support for java.util.zip.Deflater in WP_Http_Encoding::compatible_gzinflate(). Fixes #18273
git-svn-id: https://develop.svn.wordpress.org/trunk@18718 602fd350-edb4-49c9-b593-d223f7449a82
This commit is contained in:
parent
d01e2af94b
commit
d07aeb8b07
@ -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
Block a user