From 0c0de881bbc399a11775b1bf2dfc551543a1892c Mon Sep 17 00:00:00 2001
From: ryan <ryan@1a063a9b-81f0-0310-95a4-ce76da25c4cd>
Date: Tue, 5 Aug 2008 04:14:55 +0000
Subject: [PATCH] Fix reversed encoding. Props DD32. see #4779

git-svn-id: http://svn.automattic.com/wordpress/trunk@8544 1a063a9b-81f0-0310-95a4-ce76da25c4cd
---
 wp-includes/http.php | 12 +++++++-----
 1 file changed, 7 insertions(+), 5 deletions(-)

diff --git a/wp-includes/http.php b/wp-includes/http.php
index 098f33499d..ff8d7a3b85 100644
--- a/wp-includes/http.php
+++ b/wp-includes/http.php
@@ -185,23 +185,25 @@ class WP_Http {
 
 		$r = wp_parse_args( $args, $defaults );
 
-		if ( ! is_null($headers) && ! is_array($headers) ) {
+		if ( is_null($headers) )
+			$headers = array();
+
+		if ( ! is_array($headers) ) {
 			$processedHeaders = WP_Http::processHeaders($headers);
 			$headers = $processedHeaders['headers'];
-		} else {
-			$headers = array();
 		}
 
 		if ( ! isset($headers['user-agent']) || ! isset($headers['User-Agent']) )
 			$headers['user-agent'] = $r['user-agent'];
 
 		if ( is_null($body) ) {
+			$transports = WP_Http::_getTransport();
+		} else {
 			if ( is_array($body) || is_object($body) )
 				$body = http_build_query($body);
 
-			$transports = WP_Http::_getTransport();
-		} else
 			$transports = WP_Http::_postTransport();
+		}
 
 		$response = array( 'headers' => array(), 'body' => '', 'response' => array('code', 'message') );
 		foreach( (array) $transports as $transport ) {