From ad5f5db86116b8f106424542eef4f83470dbda3b Mon Sep 17 00:00:00 2001 From: dd32 Date: Sat, 23 Apr 2011 13:49:52 +0000 Subject: [PATCH] Allow the cURL transport to handle '0' response bodies. Fixes #17223 git-svn-id: http://svn.automattic.com/wordpress/trunk@17692 1a063a9b-81f0-0310-95a4-ce76da25c4cd --- wp-includes/class-http.php | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/wp-includes/class-http.php b/wp-includes/class-http.php index 5dde512e3..127b84c4f 100644 --- a/wp-includes/class-http.php +++ b/wp-includes/class-http.php @@ -1091,11 +1091,11 @@ class WP_Http_Curl { $theBody = ''; $theHeaders = WP_Http::processHeaders( $this->headers ); - if ( ! empty($theResponse) && ! is_bool( $theResponse ) ) // is_bool: when using $args['stream'], curl_exec will return (bool)true + if ( strlen($theResponse) > 0 && ! is_bool( $theResponse ) ) // is_bool: when using $args['stream'], curl_exec will return (bool)true $theBody = $theResponse; // If no response, and It's not a HEAD request with valid headers returned - if ( empty($theResponse) && ('HEAD' != $args['method'] || empty($this->headers)) ) { + if ( 0 == strlen($theResponse) && ('HEAD' != $args['method'] || empty($this->headers)) ) { if ( $curl_error = curl_error($handle) ) return new WP_Error('http_request_failed', $curl_error); if ( in_array( curl_getinfo( $handle, CURLINFO_HTTP_CODE ), array(301, 302) ) )