From 65e7885c01eb1f52e4aa9fca06e982bdd9ce9312 Mon Sep 17 00:00:00 2001 From: Dion Hulse Date: Thu, 29 Jan 2015 03:58:23 +0000 Subject: [PATCH] HTTP API: Fix an issue where the `limit_response_size` parameter wasn't working properly with large documents and the cURL transport. Fixes #31172 Built from https://develop.svn.wordpress.org/trunk@31290 git-svn-id: http://core.svn.wordpress.org/trunk@31271 1a063a9b-81f0-0310-95a4-ce76da25c4cd --- wp-includes/class-http.php | 12 +++++++++--- wp-includes/version.php | 2 +- 2 files changed, 10 insertions(+), 4 deletions(-) diff --git a/wp-includes/class-http.php b/wp-includes/class-http.php index 6f2e28cc22..2b27658f89 100644 --- a/wp-includes/class-http.php +++ b/wp-includes/class-http.php @@ -1520,10 +1520,16 @@ class WP_Http_Curl { // If an error occurred, or, no response. if ( $curl_error || ( 0 == strlen( $theBody ) && empty( $theHeaders['headers'] ) ) ) { - if ( CURLE_WRITE_ERROR /* 23 */ == $curl_error && $r['stream'] ) { + if ( CURLE_WRITE_ERROR /* 23 */ == $curl_error ) { if ( ! $this->max_body_length || $this->max_body_length != $bytes_written_total ) { - fclose( $this->stream_handle ); - return new WP_Error( 'http_request_failed', __( 'Failed to write request to temporary file.' ) ); + if ( $r['stream'] ) { + curl_close( $handle ); + fclose( $this->stream_handle ); + return new WP_Error( 'http_request_failed', __( 'Failed to write request to temporary file.' ) ); + } else { + curl_close( $handle ); + return new WP_Error( 'http_request_failed', curl_error( $handle ) ); + } } } else { if ( $curl_error = curl_error( $handle ) ) { diff --git a/wp-includes/version.php b/wp-includes/version.php index 171468dff1..1de6f5978f 100644 --- a/wp-includes/version.php +++ b/wp-includes/version.php @@ -4,7 +4,7 @@ * * @global string $wp_version */ -$wp_version = '4.2-alpha-31289'; +$wp_version = '4.2-alpha-31290'; /** * Holds the WordPress DB revision, increments when changes are made to the WordPress DB schema.