Index: class-http.php
===================================================================
--- class-http.php	(revision 15364)
+++ class-http.php	(working copy)
@@ -434,6 +434,8 @@
 		$cookies = array();
 		$newheaders = array();
 		foreach ( $headers as $tempheader ) {
+			// Sanity check, this should never be true, but prevents no lines from processing. Also
+			// the rare event that there are lines in between the headers that are empty.
 			if ( empty($tempheader) )
 				continue;
 
@@ -443,15 +445,16 @@
 			}
 
 			list($key, $value) = explode(':', $tempheader, 2);
+			$value = trim( $value ); // Remove spaces before and after for the value.
 
-			if ( !empty( $value ) ) {
+			if ( $value != '' ) {
 				$key = strtolower( $key );
 				if ( isset( $newheaders[$key] ) ) {
 					if ( !is_array($newheaders[$key]) )
 						$newheaders[$key] = array($newheaders[$key]);
-					$newheaders[$key][] = trim( $value );
+					$newheaders[$key][] = $value;
 				} else {
-					$newheaders[$key] = trim( $value );
+					$newheaders[$key] = $value;
 				}
 				if ( 'set-cookie' == $key )
 					$cookies[] = new WP_Http_Cookie( $value );
@@ -491,6 +494,8 @@
 	 * Based off the HTTP http_encoding_dechunk function. Does not support UTF-8. Does not support
 	 * returning footer headers. Shouldn't be too difficult to support it though.
 	 *
+	 * @link http://tools.ietf.org/html/rfc2616#section-19.4.6 Process for chunked decoding.
+	 *
 	 * @todo Add support for footer chunked headers.
 	 * @access public
 	 * @since 2.7.0
@@ -512,6 +517,11 @@
 			$hasChunk = (bool) preg_match( '/^([0-9a-f]+)(\s|\n)+/mi', $body, $match );
 
 			if ( $hasChunk ) {
+				// http://tools.ietf.org/html/rfc2616#page-14 - Augmented BNF states what *rule
+				// Means and the chunked encoding http://tools.ietf.org/html/rfc2616#section-3.6.1
+				// defined says that only one HEX character is required. In many cases during
+				// testing, the last HEX digit will be '0' and will match. If not, then nothing
+				// will be adversely affected.
 				if ( empty( $match[1] ) )
 					return $body;
 
@@ -1735,7 +1745,7 @@
 			// Set everything else as a property
 			foreach ( $pairs as $pair ) {
 				$pair = rtrim($pair);
-				if ( empty($pair) ) //Handles the cookie ending in ; which results in a empty final pair
+				if ( $pair == '' ) //Handles the cookie ending in ; which results in a empty final pair
 					continue;
 
 				list( $key, $val ) = strpos( $pair, '=' ) ? explode( '=', $pair ) : array( $pair, '' );
@@ -1814,7 +1824,7 @@
 	 * @return string Header encoded cookie name and value.
 	 */
 	function getHeaderValue() {
-		if ( empty( $this->name ) || empty( $this->value ) )
+		if ( $this->name == '' || $this->value == '' )
 			return '';
 
 		return $this->name . '=' . urlencode( $this->value );
