From db0ecb64698c29ab9f3b298113e64f091e79e4f4 Mon Sep 17 00:00:00 2001 From: Ryan McCue Date: Fri, 13 May 2016 11:14:06 +0000 Subject: [PATCH] HTTP API: Fix compatibility with cURL <7.22 Ensure connections are closed after usage to fix an issue with WP.com URLs used in the tests. Resynched from GitHub at 95518ce. See #33055. git-svn-id: https://develop.svn.wordpress.org/trunk@37430 602fd350-edb4-49c9-b593-d223f7449a82 --- src/wp-includes/Requests/Transport/cURL.php | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/src/wp-includes/Requests/Transport/cURL.php b/src/wp-includes/Requests/Transport/cURL.php index 5f5c5dfb0a..04914440e6 100755 --- a/src/wp-includes/Requests/Transport/cURL.php +++ b/src/wp-includes/Requests/Transport/cURL.php @@ -309,6 +309,11 @@ class Requests_Transport_cURL implements Requests_Transport { protected function setup_handle($url, $headers, $data, $options) { $options['hooks']->dispatch('curl.before_request', array(&$this->handle)); + // Force closing the connection for old versions of cURL (<7.22). + if ( ! isset( $headers['Connection'] ) ) { + $headers['Connection'] = 'close'; + } + $headers = Requests::flatten($headers); if (!empty($data)) {