X-Git-Url: https://scripts.mit.edu/gitweb/autoinstalls/wordpress.git/blobdiff_plain/b22765f41bf0b2021b9beb9120ee0ac91fa89292..7160a0bb85708fe18beae56a6dfd046520f300bd:/wp-includes/Requests/Transport/cURL.php?ds=sidebyside diff --git a/wp-includes/Requests/Transport/cURL.php b/wp-includes/Requests/Transport/cURL.php index 453f73b7..4429edb6 100644 --- a/wp-includes/Requests/Transport/cURL.php +++ b/wp-includes/Requests/Transport/cURL.php @@ -347,7 +347,7 @@ class Requests_Transport_cURL implements Requests_Transport { default: curl_setopt($this->handle, CURLOPT_CUSTOMREQUEST, $options['type']); if (!empty($data)) { - curl_setopt( $this->handle, CURLOPT_POSTFIELDS, $data ); + curl_setopt($this->handle, CURLOPT_POSTFIELDS, $data); } } @@ -375,8 +375,9 @@ class Requests_Transport_cURL implements Requests_Transport { curl_setopt($this->handle, CURLOPT_URL, $url); curl_setopt($this->handle, CURLOPT_REFERER, $url); curl_setopt($this->handle, CURLOPT_USERAGENT, $options['useragent']); - curl_setopt($this->handle, CURLOPT_HTTPHEADER, $headers); - + if (!empty($headers)) { + curl_setopt($this->handle, CURLOPT_HTTPHEADER, $headers); + } if ($options['protocol_version'] === 1.1) { curl_setopt($this->handle, CURLOPT_HTTP_VERSION, CURL_HTTP_VERSION_1_1); } @@ -458,7 +459,7 @@ class Requests_Transport_cURL implements Requests_Transport { * @param string $data Body data * @return integer Length of provided data */ - protected function stream_body($handle, $data) { + public function stream_body($handle, $data) { $this->hooks->dispatch('request.progress', array($data, $this->response_bytes, $this->response_byte_limit)); $data_length = strlen($data); @@ -524,7 +525,7 @@ class Requests_Transport_cURL implements Requests_Transport { * @return boolean True if the transport is valid, false otherwise. */ public static function test($capabilities = array()) { - if (!function_exists('curl_init') && !function_exists('curl_exec')) { + if (!function_exists('curl_init') || !function_exists('curl_exec')) { return false; }