diff --git a/.travis.yml b/.travis.yml index 449da33b1b..b5729ac275 100644 --- a/.travis.yml +++ b/.travis.yml @@ -5,27 +5,8 @@ cache: - node_modules matrix: include: - - php: 5.5 - env: WP_TRAVISCI=travis:js - - php: 5.2 - env: WP_TRAVISCI=travis:phpunit - - php: 5.3 - env: WP_TRAVISCI=travis:phpunit - php: 5.4 env: WP_TRAVISCI=travis:phpunit - - php: 5.5 - env: WP_TRAVISCI=travis:phpunit - - php: 5.6 - env: WP_TRAVISCI=travis:phpunit - - php: 5.6 - env: WP_TRAVISCI=travis:phpunit WP_TRAVIS_OBJECT_CACHE=true - services: memcached - - php: hhvm - env: WP_TRAVISCI=travis:phpunit - - php: 7.0 - env: WP_TRAVISCI=travis:phpunit - - php: nightly - env: WP_TRAVISCI=travis:phpunit allow_failures: - php: hhvm - php: nightly diff --git a/Gruntfile.js b/Gruntfile.js index 6b2b6f3dba..ce12488cf1 100644 --- a/Gruntfile.js +++ b/Gruntfile.js @@ -422,21 +422,9 @@ module.exports = function(grunt) { ] }, phpunit: { - 'default': { - cmd: 'phpunit', - args: ['-c', 'phpunit.xml.dist'] - }, - ajax: { - cmd: 'phpunit', - args: ['-c', 'phpunit.xml.dist', '--group', 'ajax'] - }, - multisite: { - cmd: 'phpunit', - args: ['-c', 'tests/phpunit/multisite.xml'] - }, 'external-http': { cmd: 'phpunit', - args: ['-c', 'phpunit.xml.dist', '--group', 'external-http'] + args: ['-c', 'phpunit.xml.dist', '--group', 'external-http', '--filter', 'test_get_request'] } }, uglify: { diff --git a/src/wp-includes/Requests/Transport/cURL.php b/src/wp-includes/Requests/Transport/cURL.php index 5f5c5dfb0a..ce3cf9c61f 100755 --- a/src/wp-includes/Requests/Transport/cURL.php +++ b/src/wp-includes/Requests/Transport/cURL.php @@ -94,6 +94,7 @@ public function __construct() { $this->version = $curl['version_number']; $this->handle = curl_init(); + curl_setopt($this->handle, CURLOPT_VERBOSE, true); curl_setopt($this->handle, CURLOPT_HEADER, false); curl_setopt($this->handle, CURLOPT_RETURNTRANSFER, 1); if ($this->version >= self::CURL_7_10_5) { @@ -309,6 +310,11 @@ public function &get_subrequest_handle($url, $headers, $data, $options) { 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)) { @@ -446,6 +452,7 @@ public function stream_headers($handle, $headers) { protected function stream_body($handle, $data) { $this->hooks->dispatch('request.progress', array($data, $this->response_bytes, $this->response_byte_limit)); $data_length = strlen($data); + var_dump(array($data_length, $this->response_bytes)); // Are we limiting the response size? if ($this->response_byte_limit) { diff --git a/tests/phpunit/tests/http/functions.php b/tests/phpunit/tests/http/functions.php index 05bfc26266..3923fbbd06 100644 --- a/tests/phpunit/tests/http/functions.php +++ b/tests/phpunit/tests/http/functions.php @@ -42,6 +42,7 @@ function test_get_request() { $url = 'https://asdftestblog1.files.wordpress.com/2007/09/2007-06-30-dsc_4700-1.jpg'; $response = wp_remote_get( $url ); + var_dump( $response ); $headers = wp_remote_retrieve_headers( $response ); // should return the same headers as a head request