WordPress 4.6.2
[autoinstalls/wordpress.git] / wp-includes / Requests / Transport / cURL.php
index 7979b2eba0430f121a0e6e71d50a5c9ad73a5c10..4429edb647321c18bcd6bc44cce025a868fae1af 100644 (file)
@@ -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);