Index: class-http.php
===================================================================
--- class-http.php	(revision 23178)
+++ class-http.php	(working copy)
@@ -166,8 +166,8 @@
 		// Construct Cookie: header if any cookies are set
 		WP_Http::buildCookieHeader( $r );
 
-		if ( WP_Http_Encoding::is_available() )
-			$r['headers']['Accept-Encoding'] = WP_Http_Encoding::accept_encoding();
+		if ( ! isset( $r['headers']['Accept-Encoding'] ) )
+			$r['headers']['Accept-Encoding'] = WP_Http_Encoding::accept_encoding( $url, $r );
 
 		if ( ( ! is_null( $r['body'] ) && '' != $r['body'] ) || 'POST' == $r['method'] || 'PUT' == $r['method'] ) {
 			if ( is_array( $r['body'] ) || is_object( $r['body'] ) ) {
@@ -1730,16 +1745,23 @@
 	 *
 	 * @return string Types of encoding to accept.
 	 */
-	public static function accept_encoding() {
+	public static function accept_encoding( $url, $r ) {
 		$type = array();
-		if ( function_exists( 'gzinflate' ) )
-			$type[] = 'deflate;q=1.0';
 
-		if ( function_exists( 'gzuncompress' ) )
-			$type[] = 'compress;q=0.5';
+		// The "identity" content-coding is always acceptable by the RFC, we're just specifically allowing it
+		$type[] = 'identity;q=1.0';
 
-		if ( function_exists( 'gzdecode' ) )
-			$type[] = 'gzip;q=0.5';
+		// Disable compression support when saving to file, as otherwise we'll save the compressed data
+		if ( ! $r['stream'] ) {
+			if ( function_exists( 'gzinflate' ) )
+				$type[] = 'deflate;q=1.0';
+	
+			if ( function_exists( 'gzuncompress' ) )
+				$type[] = 'compress;q=0.5';
+	
+			if ( function_exists( 'gzdecode' ) )
+				$type[] = 'gzip;q=0.5';
+		}
 
 		return implode(', ', $type);
 	}
