Changeset 23601
- Timestamp:
- 03/04/2013 03:33:12 AM (12 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/wp-includes/class-http.php
r23600 r23601 167 167 WP_Http::buildCookieHeader( $r ); 168 168 169 if ( ! isset( $r['headers']['Accept-Encoding'] ) && WP_Http_Encoding::is_available() ) 170 $r['headers']['Accept-Encoding'] = WP_Http_Encoding::accept_encoding(); 169 if ( ! isset( $r['headers']['Accept-Encoding'] ) ) { 170 if ( $encoding = WP_Http_Encoding::accept_encoding( $url, $r ) ) 171 $r['headers']['Accept-Encoding'] = $encoding; 172 } 171 173 172 174 if ( ( ! is_null( $r['body'] ) && '' != $r['body'] ) || 'POST' == $r['method'] || 'PUT' == $r['method'] ) { … … 1731 1733 * @return string Types of encoding to accept. 1732 1734 */ 1733 public static function accept_encoding( ) {1735 public static function accept_encoding( $url, $args ) { 1734 1736 $type = array(); 1735 if ( function_exists( 'gzinflate' ) ) 1736 $type[] = 'deflate;q=1.0'; 1737 1738 if ( function_exists( 'gzuncompress' ) ) 1739 $type[] = 'compress;q=0.5'; 1740 1741 if ( function_exists( 'gzdecode' ) ) 1742 $type[] = 'gzip;q=0.5'; 1737 $compression_enabled = WP_Http_Encoding::is_available(); 1738 1739 if ( ! $args['decompress'] ) // decompression specifically disabled 1740 $compression_enabled = false; 1741 elseif ( $args['stream'] ) // disable when streaming to file 1742 $compression_enabled = false; 1743 1744 if ( $compression_enabled ) { 1745 if ( function_exists( 'gzinflate' ) ) 1746 $type[] = 'deflate;q=1.0'; 1747 1748 if ( function_exists( 'gzuncompress' ) ) 1749 $type[] = 'compress;q=0.5'; 1750 1751 if ( function_exists( 'gzdecode' ) ) 1752 $type[] = 'gzip;q=0.5'; 1753 } 1754 1755 $type = apply_filters( 'wp_http_accept_encoding', $type, $url, $args ); 1743 1756 1744 1757 return implode(', ', $type);
Note: See TracChangeset
for help on using the changeset viewer.