Index: wp-includes/class-http.php
===================================================================
--- wp-includes/class-http.php	(revision 23178)
+++ wp-includes/class-http.php	(working copy)
@@ -1653,9 +1653,6 @@
 		if ( empty($compressed) )
 			return $compressed;
 
-		if ( false !== ( $decompressed = @gzinflate( $compressed ) ) )
-			return $decompressed;
-
 		if ( false !== ( $decompressed = WP_Http_Encoding::compatible_gzinflate( $compressed ) ) )
 			return $decompressed;
 
@@ -1694,7 +1691,7 @@
 	 */
 	public static function compatible_gzinflate($gzData) {
 
-		// Compressed data might contain a full header, if so strip it for gzinflate()
+		// Compressed data might contain a full zlib header, if so strip it for gzinflate()
 		if ( substr($gzData, 0, 3) == "\x1f\x8b\x08" ) {
 			$i = 10;
 			$flg = ord( substr($gzData, 3, 1) );
@@ -1715,11 +1712,29 @@
 				return $decompressed;
 		}
 
-		// Compressed data from java.util.zip.Deflater amongst others.
-		$decompressed = @gzinflate( substr($gzData, 2) );
-		if ( false !== $decompressed )
+		// If the data is Huffman Encoded, we must first strip the leading 2 byte Huffman marker for gzinflate()
+		// The Response is Huffman coded by many compressors such as java.util.zip.Deflater,
+		// Ruby’s Zlib::Deflate, and .NET's System.IO.Compression.DeflateStream.
+		// See http://decompres.blogspot.com/ for a quick explanation of this data type
+		$huffman_encoded = false;
+		list( $first_nibble ) = unpack( 'h', $gzData[0] ); // low nibble of first byte should be 0x08
+		list( $first_two_bytes ) = unpack( 'n', substr( $gzData, 0, 2 ) ); // First 2 bytes should be divisible by 0x1F
+		if ( 0x08 == $first_nibble && 0 == ( $first_two_bytes % 0x1F ) )
+			$huffman_encoded = true;
+
+		if ( $huffman_encoded ) {
+			if ( false !== ( $decompressed = @gzinflate( substr( $gzData, 2 ) ) ) )
+				return $decompressed;
+		}
+
+		// Finally fall back to straight gzinflate
+		if ( false !== ( $decompressed = @gzinflate( $gzData ) ) )
 			return $decompressed;
 
+		// Fallback for all above failing, not expected, but included for debugging and preventing regressions
+		if ( false !== ( $decompressed = @gzinflate( substr( $gzData, 2 ) ) ) )
+			return $decompressed;
+
 		return false;
 	}
 
