From f71b60e873ff6a9d9e0cde150a4e7f3f1ccc0e96 Mon Sep 17 00:00:00 2001 From: Valeriy Tropin Date: Fri, 19 Jun 2015 10:38:28 +0300 Subject: [PATCH 1/2] Add data processing using the Curl::buildPostData() in the Curl::patch() --- src/Curl/Curl.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/Curl/Curl.php b/src/Curl/Curl.php index 23aa7f0..ba8cc2d 100644 --- a/src/Curl/Curl.php +++ b/src/Curl/Curl.php @@ -444,7 +444,7 @@ class Curl $this->setURL($url); $this->unsetHeader('Content-Length'); $this->setOpt(CURLOPT_CUSTOMREQUEST, 'PATCH'); - $this->setOpt(CURLOPT_POSTFIELDS, $data); + $this->setOpt(CURLOPT_POSTFIELDS, $this->buildPostData($data)); return $this->exec(); } From 2465bf4c171255eba36438e9cd15c486d58011f9 Mon Sep 17 00:00:00 2001 From: Zach Borboa Date: Wed, 19 Aug 2015 23:26:21 -0700 Subject: [PATCH 2/2] Fix invalid request when Content-Length is unset. "Invalid request (Malformed HTTP request)" and "Empty reply from server" is returned when attempting to unset the Content-Length header by sending a "Content-Length: " header. --- src/Curl/Curl.php | 1 - 1 file changed, 1 deletion(-) diff --git a/src/Curl/Curl.php b/src/Curl/Curl.php index c3612ca..038a94a 100644 --- a/src/Curl/Curl.php +++ b/src/Curl/Curl.php @@ -442,7 +442,6 @@ class Curl $url = $this->baseUrl; } $this->setURL($url); - $this->unsetHeader('Content-Length'); $this->setOpt(CURLOPT_CUSTOMREQUEST, 'PATCH'); $this->setOpt(CURLOPT_POSTFIELDS, $this->buildPostData($data)); return $this->exec();