wp/wp-includes/class-wp-http-curl.php
changeset 19 3d72ae0968f4
parent 18 be944660c56a
child 21 48c4eec2b7e6
--- a/wp/wp-includes/class-wp-http-curl.php	Wed Sep 21 18:19:35 2022 +0200
+++ b/wp/wp-includes/class-wp-http-curl.php	Tue Sep 27 16:37:53 2022 +0200
@@ -115,7 +115,7 @@
 			/** This filter is documented in wp-includes/class-wp-http-streams.php */
 			$ssl_verify = apply_filters( 'https_local_ssl_verify', $ssl_verify, $url );
 		} elseif ( ! $is_local ) {
-			/** This filter is documented in wp-includes/class-http.php */
+			/** This filter is documented in wp-includes/class-wp-http.php */
 			$ssl_verify = apply_filters( 'https_ssl_verify', $ssl_verify, $url );
 		}
 
@@ -256,8 +256,9 @@
 		}
 
 		curl_exec( $handle );
-		$theHeaders          = WP_Http::processHeaders( $this->headers, $url );
-		$theBody             = $this->body;
+
+		$processed_headers   = WP_Http::processHeaders( $this->headers, $url );
+		$body                = $this->body;
 		$bytes_written_total = $this->bytes_written_total;
 
 		$this->headers             = '';
@@ -267,9 +268,9 @@
 		$curl_error = curl_errno( $handle );
 
 		// If an error occurred, or, no response.
-		if ( $curl_error || ( 0 == strlen( $theBody ) && empty( $theHeaders['headers'] ) ) ) {
-			if ( CURLE_WRITE_ERROR /* 23 */ == $curl_error ) {
-				if ( ! $this->max_body_length || $this->max_body_length != $bytes_written_total ) {
+		if ( $curl_error || ( 0 === strlen( $body ) && empty( $processed_headers['headers'] ) ) ) {
+			if ( CURLE_WRITE_ERROR /* 23 */ === $curl_error ) {
+				if ( ! $this->max_body_length || $this->max_body_length !== $bytes_written_total ) {
 					if ( $parsed_args['stream'] ) {
 						curl_close( $handle );
 						fclose( $this->stream_handle );
@@ -299,24 +300,26 @@
 		}
 
 		$response = array(
-			'headers'  => $theHeaders['headers'],
+			'headers'  => $processed_headers['headers'],
 			'body'     => null,
-			'response' => $theHeaders['response'],
-			'cookies'  => $theHeaders['cookies'],
+			'response' => $processed_headers['response'],
+			'cookies'  => $processed_headers['cookies'],
 			'filename' => $parsed_args['filename'],
 		);
 
 		// Handle redirects.
-		$redirect_response = WP_HTTP::handle_redirects( $url, $parsed_args, $response );
+		$redirect_response = WP_Http::handle_redirects( $url, $parsed_args, $response );
 		if ( false !== $redirect_response ) {
 			return $redirect_response;
 		}
 
-		if ( true === $parsed_args['decompress'] && true === WP_Http_Encoding::should_decode( $theHeaders['headers'] ) ) {
-			$theBody = WP_Http_Encoding::decompress( $theBody );
+		if ( true === $parsed_args['decompress']
+			&& true === WP_Http_Encoding::should_decode( $processed_headers['headers'] )
+		) {
+			$body = WP_Http_Encoding::decompress( $body );
 		}
 
-		$response['body'] = $theBody;
+		$response['body'] = $body;
 
 		return $response;
 	}