From 20141db4eb2baa6942a95e8ba22c0565fe75f006 Mon Sep 17 00:00:00 2001 From: Dion Hulse Date: Thu, 5 Apr 2012 11:58:04 +0000 Subject: [PATCH] WP_HTTP: Curl: Correct a typo in [20208] causing failed curl requests not to return a WP_Error under certain situations. Props SergeyBiryukov. Fixes #20219 git-svn-id: https://develop.svn.wordpress.org/trunk@20370 602fd350-edb4-49c9-b593-d223f7449a82 --- wp-includes/class-http.php | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/wp-includes/class-http.php b/wp-includes/class-http.php index 4c59e66cff..7212ae71ad 100644 --- a/wp-includes/class-http.php +++ b/wp-includes/class-http.php @@ -1110,11 +1110,11 @@ class WP_Http_Curl { $theBody = $theResponse; // If no response - if ( 0 == strlen($theResponse) && empty( $theHeaders ) ) { - 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) ) ) - return new WP_Error('http_request_failed', __('Too many redirects.')); + if ( 0 == strlen( $theResponse ) && empty( $theHeaders->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 ) ) ) + return new WP_Error( 'http_request_failed', __( 'Too many redirects.' ) ); } $this->headers = '';