php.net |  support |  documentation |  report a bug |  advanced search |  search howto |  statistics |  random bug |  login
Bug #68149 duplicate content-length
Submitted: 2014-10-03 21:14 UTC Modified: 2014-11-05 19:46 UTC
From: kontakt at kukulich dot cz Assigned: mike (profile)
Status: Closed Package: pecl_http (PECL)
PHP Version: Irrelevant OS:
Private report: No CVE-ID: None
View Add Comment Developer Edit
Welcome! If you don't have a Git account, you can't do anything here.
You can add a comment by following this link or if you reported this bug, you can edit this bug over here.
Block user comment
Status: Assign to:
Package:
Bug Type:
Summary:
From: kontakt at kukulich dot cz
New email:
PHP Version: OS:

 

 [2014-10-03 21:14 UTC] kontakt at kukulich dot cz
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

Patches

Add a Patch

Pull Requests

Add a Pull Request

History

AllCommentsChangesGit/SVN commitsRelated reports
 [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
According to the curl changelog, this may fail until 7.23.
 [2014-11-06 12:07 UTC] mike@php.net
Automatic comment on behalf of mike
Revision: http://git.php.net/?p=pecl/http/pecl_http.git;a=commit;h=acffb304a34e5e2a09c234f54179c34a0e8d3226
Log: Fixed bug #68149 (duplicate content-length with libcurl &lt; 7.23)
 [2014-11-06 12:07 UTC] mike@php.net
-Status: Assigned +Status: Closed
 
PHP Copyright © 2001-2024 The PHP Group
All rights reserved.
Last updated: Thu Mar 28 18:01:29 2024 UTC