Changeset 11684 for trunk/wp-includes/http.php
- Timestamp:
- 07/02/2009 11:18:27 PM (17 years ago)
- File:
-
- 1 edited
-
trunk/wp-includes/http.php (modified) (2 diffs)
Legend:
- Unmodified
- Added
- Removed
-
trunk/wp-includes/http.php
r11653 r11684 1785 1785 */ 1786 1786 function decompress( $compressed, $length = null ) { 1787 $decompressed = gzinflate( $compressed );1787 $decompressed = WP_Http_Encoding::compatible_gzinflate( $compressed ); 1788 1788 1789 1789 if ( false !== $decompressed ) … … 1803 1803 1804 1804 return $compressed; 1805 } 1806 1807 /** 1808 * Decompression of deflated string while staying compatible with the majority of servers. 1809 * 1810 * Certain Servers will return deflated data with headers which PHP's gziniflate() 1811 * function cannot handle out of the box. The following function lifted from 1812 * http://au2.php.net/manual/en/function.gzinflate.php#77336 will attempt to deflate 1813 * the various return forms used. 1814 * 1815 * @since 2.8.1 1816 * @link http://au2.php.net/manual/en/function.gzinflate.php#77336 1817 * 1818 * @param string $gzData String to decompress. 1819 * @return string|bool False on failure. 1820 */ 1821 function compatible_gzinflate($gzData) { 1822 if ( substr($gzData, 0, 3) == "\x1f\x8b\x08" ) { 1823 $i = 10; 1824 $flg = ord( substr($gzData, 3, 1) ); 1825 if ( $flg > 0 ) { 1826 if ( $flg & 4 ) { 1827 list($xlen) = unpack('v', substr($gzData, $i, 2) ); 1828 $i = $i + 2 + $xlen; 1829 } 1830 if ( $flg & 8 ) 1831 $i = strpos($gzData, "\0", $i) + 1; 1832 if ( $flg & 16 ) 1833 $i = strpos($gzData, "\0", $i) + 1; 1834 if ( $flg & 2 ) 1835 $i = $i + 2; 1836 } 1837 return gzinflate( substr($gzData, $i, -8) ); 1838 } else { 1839 return false; 1840 } 1805 1841 } 1806 1842
Note: See TracChangeset
for help on using the changeset viewer.