|
php.net | support | documentation | report a bug | advanced search | search howto | statistics | random bug | login |
PatchesPull RequestsHistoryAllCommentsChangesGit/SVN commits
[2014-11-05 19:46 UTC] mike@php.net
-Summary: PUT method not working with cURL 7.19.7
+Summary: duplicate content-length
-Assigned To:
+Assigned To: mike
[2014-11-05 19:46 UTC] mike@php.net
[2014-11-06 12:07 UTC] mike@php.net
[2014-11-06 12:07 UTC] mike@php.net
-Status: Assigned
+Status: Closed
|
|||||||||||||||||||||||||||
Copyright © 2001-2025 The PHP GroupAll rights reserved. |
Last updated: Sun Nov 02 03:00:01 2025 UTC |
Description: ------------ PUT methods doesn't work with cURL 7.19.7 (CentOS 6.4) because of duplicated header "Content-Length". Nginx refuses to process request and sends "400 Bad Request". It works with cURL 7.36.0 (Windows 7) or 7.38.0-2 (Arch Linux). Sent headers: PUT /file.ico HTTP/1.1 User-Agent: PECL_HTTP/2.1.2 PHP/5.5.17 libcurl/7.19.7 Host: webdav.local Accept: */* Content-Length: 15086 Content-Length: 15086 Test script: --------------- <?php $host = 'webdav.local'; $file = 'file.ico'; $data = file_get_contents($file); $httpClient = new \http\Client(); $httpRequestBody1 = new \http\Message\Body(); $httpRequestBody1->append($data); $httpRequest1 = new \http\Client\Request('PUT', $host . '/file.ico'); $httpRequest1->setHeader('Expect', ''); $httpRequest1->setBody($httpRequestBody1); $httpClient->reset(); $httpClient->enqueue($httpRequest1); $httpClient->send(); $httpResponse1 = $httpClient->getResponse(); echo sprintf("%s:%s\n", $httpResponse1->getResponseCode(), $httpResponse1->getResponseStatus()); Expected result: ---------------- 201:Created Actual result: -------------- 400:Bad Request