Index: http.php
===================================================================
--- http.php	(revision 10235)
+++ http.php	(working copy)
@@ -13,6 +13,236 @@
  */
 
 /**
+ * Interface for the implementations of compression and decompression in PHP.
+ *
+ * This class will be checked for when adding classes that can be implemented.
+ *
+ * @abstract
+ * @since unknown
+ */
+class WP_Http_Deflate_Interface {
+
+	/**
+	 * Child classes should compress strings in this method.
+	 *
+	 * @since unknown
+	 *
+	 * @param string $raw Raw string to compress.
+	 * @param int $level Optional, default is 9. Level of compression, usually 0 (none) through 9 (most).
+	 * @return string
+	 */
+	function compress( $raw, $level = 9 ) {
+		trigger_error('Not implemented!', E_USER_FATAL);
+	}
+
+	/**
+	 * Decompress string that was compressed by the compress method.
+	 *
+	 * @since unknown
+	 *
+	 * @param string $compressed
+	 * @return string
+	 */
+	function decompress( $compressed ) {
+		trigger_error('Not implemented!', E_USER_FATAL);
+	}
+
+	/**
+	 * Child classes should return the transfer encoding types that are supported.
+	 *
+	 * @since unknown
+	 * @return array
+	 */
+	function accept() {
+		trigger_error('Not implemented!', E_USER_FATAL);
+	}
+
+	/**
+	 * Child classes should return the transfer encoding type if used.
+	 *
+	 * @since unknown
+	 * @return string
+	 */
+	function type() {
+		trigger_error('Not implemented!', E_USER_FATAL);
+	}
+
+	/**
+	 * Child classes should return whether the class can be used.
+	 *
+	 * @since unknown
+	 * @return bool
+	 */
+	function is_available() {
+		trigger_error('Not implemented!', E_USER_FATAL);
+	}
+
+}
+
+/**
+ * Decompression implementation for deflate transfer encodings.
+ *
+ * Includes both RFC 1950 and RFC 1951.
+ *
+ * @since unknown
+ * @uses WP_Http_Deflate_Interface Extends class.
+ */
+class WP_Http_Deflate extends WP_Http_Deflate_Interface {
+
+	/**
+	 * Compress raw string using the deflate format.
+	 *
+	 * Supports the RFC 1950 standard.
+	 *
+	 * @since unknown
+	 *
+	 * @param string $raw String to compress.
+	 * @param int $level Optional, default is 9. Compression level, 9 is highest.
+	 * @return string|bool False on failure.
+	 */
+	function compress( $raw, $level = 9 ) {
+		return gzcompress( $raw, $level );
+	}
+
+	/**
+	 * Decompression of deflated string.
+	 *
+	 * Will attempt to decompress using the RFC 1950 standard, and if that fails
+	 * then the RFC 1951 standard deflate will be attempted.
+	 *
+	 * @since unknown
+	 *
+	 * @param string $compressed String to decompress.
+	 * @return string|bool False on failure.
+	 */
+	function decompress( $compressed ) {
+		$decompressed = gzuncompress( $text );
+
+		if( false === $decompressed )
+			return gzinflate( $text );
+
+		return $decompressed;
+	}
+
+	/**
+	 * Supported transfer encoding types.
+	 *
+	 * @since unknown
+	 *
+	 * @return array
+	 */
+	function accept() {
+		return array( 'compress', 'x-compress', 'deflate' )
+	}
+
+	/**
+	 * The accept encoding type, if supported.
+	 *
+	 * @since unknown
+	 *
+	 * @return string
+	 */
+	function type() {
+		return 'deflate';
+	}
+
+	/**
+	 * Whether decompression and compression are supported by the PHP version.
+	 *
+	 * Each function is tested instead of checking for the zlib extension, to
+	 * ensure that the functions all exist in the PHP version and aren't
+	 * disabled.
+	 *
+	 * @since unknown
+	 *
+	 * @return bool
+	 */
+	function is_available() {
+		return ( function_exists('gzuncompress') && function_exists('gzcompress') &&
+				 function_exists('gzinflate') );
+	}
+
+}
+
+/**
+ * Decompression implementation for Gzip transfer encodings.
+ *
+ * For RFC 1952.
+ *
+ * @since unknown
+ * @uses WP_Http_Deflate_Interface Extends class.
+ */
+class WP_Http_Gzip extends WP_Http_Deflate_Interface {
+
+	/**
+	 * Compress raw string using the gzip format.
+	 *
+	 * Supports the RFC 1952 standard.
+	 *
+	 * @since unknown
+	 *
+	 * @param string $raw String to compress.
+	 * @param int $level Optional, default is 9. Compression level, 9 is highest.
+	 * @return string|bool False on failure.
+	 */
+	function compress( $raw, $level = 9 ) {
+		return gzencode( $raw, $level );
+	}
+
+	/**
+	 * Decompression of gzip string.
+	 *
+	 * Supports the RFC 1952 standard.
+	 *
+	 * @since unknown
+	 *
+	 * @param string $compressed String to decompress.
+	 * @return string|bool False on failure.
+	 */
+	function decompress( $compressed ) {
+		return gzdecode( $text );
+	}
+
+	/**
+	 * Supported transfer encoding types.
+	 *
+	 * @since unknown
+	 *
+	 * @return array
+	 */
+	function accept() {
+		return array( 'gzip', 'x-gzip' )
+	}
+
+	/**
+	 * The accept encoding type, if supported.
+	 *
+	 * @since unknown
+	 *
+	 * @return string
+	 */
+	function type() {
+		return 'gzip';
+	}
+
+	/**
+	 * Whether decompression and compression are supported by the PHP version.
+	 *
+	 * Each function is tested instead of checking for the zlib extension, to
+	 * ensure that the functions all exist in the PHP version and aren't
+	 * disabled.
+	 *
+	 * @since unknown
+	 *
+	 * @return bool
+	 */
+	function is_available() {
+		return ( function_exists('gzencode') && function_exists('gzdecode') );
+	}
+
+}
+
+/**
  * WordPress HTTP Class for managing HTTP Transports and making HTTP requests.
  *
  * This class is called for the functionality of making HTTP requests and should
@@ -217,7 +447,9 @@
 			'httpversion' => apply_filters( 'http_request_version', '1.0'),
 			'user-agent' => apply_filters( 'http_headers_useragent', 'WordPress/' . $wp_version ),
 			'blocking' => true,
-			'headers' => array(), 'body' => null
+			'headers' => array(),
+			'body' => null,
+			'compress' => false
 		);
 
 		$r = wp_parse_args( $args, $defaults );
