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.

Built from https://develop.svn.wordpress.org/trunk@37430


git-svn-id: http://core.svn.wordpress.org/trunk@37396 1a063a9b-81f0-0310-95a4-ce76da25c4cd
This commit is contained in:
Ryan McCue 2016-05-13 11:15:29 +00:00
parent dee1d583a7
commit 1e40ba291e
2 changed files with 6 additions and 1 deletions

View File

@ -309,6 +309,11 @@ class Requests_Transport_cURL implements Requests_Transport {
protected function setup_handle($url, $headers, $data, $options) { protected function setup_handle($url, $headers, $data, $options) {
$options['hooks']->dispatch('curl.before_request', array(&$this->handle)); $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); $headers = Requests::flatten($headers);
if (!empty($data)) { if (!empty($data)) {

View File

@ -4,7 +4,7 @@
* *
* @global string $wp_version * @global string $wp_version
*/ */
$wp_version = '4.6-alpha-37429'; $wp_version = '4.6-alpha-37430';
/** /**
* Holds the WordPress DB revision, increments when changes are made to the WordPress DB schema. * Holds the WordPress DB revision, increments when changes are made to the WordPress DB schema.