Ticket #22913: 22913.diff
File 22913.diff, 1.6 KB (added by , 12 years ago) |
---|
-
class-http.php
166 166 // Construct Cookie: header if any cookies are set 167 167 WP_Http::buildCookieHeader( $r ); 168 168 169 if ( WP_Http_Encoding::is_available() )170 $r['headers']['Accept-Encoding'] = WP_Http_Encoding::accept_encoding( );169 if ( ! isset( $r['headers']['Accept-Encoding'] ) ) 170 $r['headers']['Accept-Encoding'] = WP_Http_Encoding::accept_encoding( $url, $r ); 171 171 172 172 if ( ( ! is_null( $r['body'] ) && '' != $r['body'] ) || 'POST' == $r['method'] || 'PUT' == $r['method'] ) { 173 173 if ( is_array( $r['body'] ) || is_object( $r['body'] ) ) { … … 1730 1745 * 1731 1746 * @return string Types of encoding to accept. 1732 1747 */ 1733 public static function accept_encoding( ) {1748 public static function accept_encoding( $url, $r ) { 1734 1749 $type = array(); 1735 if ( function_exists( 'gzinflate' ) )1736 $type[] = 'deflate;q=1.0';1737 1750 1738 if ( function_exists( 'gzuncompress' ) )1739 $type[] = 'compress;q=0.5';1751 // The "identity" content-coding is always acceptable by the RFC, we're just specifically allowing it 1752 $type[] = 'identity;q=1.0'; 1740 1753 1741 if ( function_exists( 'gzdecode' ) ) 1742 $type[] = 'gzip;q=0.5'; 1754 // Disable compression support when saving to file, as otherwise we'll save the compressed data 1755 if ( ! $r['stream'] ) { 1756 if ( function_exists( 'gzinflate' ) ) 1757 $type[] = 'deflate;q=1.0'; 1758 1759 if ( function_exists( 'gzuncompress' ) ) 1760 $type[] = 'compress;q=0.5'; 1761 1762 if ( function_exists( 'gzdecode' ) ) 1763 $type[] = 'gzip;q=0.5'; 1764 } 1743 1765 1744 1766 return implode(', ', $type); 1745 1767 }