php.net |  support |  documentation |  report a bug |  advanced search |  search howto |  statistics |  random bug |  login
Bug #68083 PUT method not working after DELETE
Submitted: 2014-09-23 11:40 UTC Modified: 2014-09-23 19:28 UTC
Votes:1
Avg. Score:5.0 ± 0.0
Reproduced:1 of 1 (100.0%)
Same Version:1 (100.0%)
Same OS:1 (100.0%)
From: kontakt at kukulich dot cz Assigned: mike (profile)
Status: Closed Package: pecl_http (PECL)
PHP Version: Irrelevant OS: Windows7 64bit
Private report: No CVE-ID: None
Welcome back! If you're the original bug submitter, here's where you can edit the bug or add additional notes.
If you forgot your password, you can retrieve your password here.
Password:
Status:
Package:
Bug Type:
Summary:
From: kontakt at kukulich dot cz
New email:
PHP Version: OS:

 

 [2014-09-23 11:40 UTC] kontakt at kukulich dot cz
Description:
------------
First PUT request works. But if I send PUT request after DELETE request, the PUT request doesn't work because the request is sent with DELETE method instead of PUT method.


Webdav access log:

10.10.120.171 - - [23/Sep/2014:13:15:34 +0200] "PUT /file1.ico HTTP/1.1" 201 0 "-" "PECL_HTTP/2.1.1 PHP/5.5.11 libcurl/7.36.0"
10.10.120.171 - - [23/Sep/2014:13:15:34 +0200] "DELETE /file1.ico HTTP/1.1" 204 0 "-" "PECL_HTTP/2.1.1 PHP/5.5.11 libcurl/7.36.0"
10.10.120.171 - - [23/Sep/2014:13:15:34 +0200] "DELETE /file2.ico HTTP/1.1" 415 194 "-" "PECL_HTTP/2.1.1 PHP/5.5.11 libcurl/7.36.0" 

Webdav error log:

2014/09/23 13:15:34 [error] 19953#0: *8240 DELETE with body is unsupported, client: 10.10.120.171, server: webdav.local, request: "DELETE /file2.ico HTTP/1.1", host: "webdav.local"

Test script:
---------------
<?php

$host = 'webdav.local';
$file = 'favicon.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 . '/file1.ico');
$httpRequest1->setBody($httpRequestBody1);

$httpClient->reset();
$httpClient->enqueue($httpRequest1);
$httpClient->send();
$httpResponse1 = $httpClient->getResponse();

echo sprintf("%s:%s\n", $httpResponse1->getResponseCode(), $httpResponse1->getResponseStatus());

$httpRequest2 = new \http\Client\Request('DELETE', $host . '/file1.ico');

$httpClient->reset();
$httpClient->enqueue($httpRequest2);
$httpClient->send();
$httpResponse2 = $httpClient->getResponse();

echo sprintf("%s:%s\n", $httpResponse2->getResponseCode(), $httpResponse2->getResponseStatus());

$httpRequestBody3 = new \http\Message\Body();
$httpRequestBody3->append($data);

$httpRequest3 = new \http\Client\Request('PUT', $host . '/file2.ico');
$httpRequest3->setBody($httpRequestBody3);

$httpClient->reset();
$httpClient->enqueue($httpRequest3);
$httpClient->send();
$httpResponse3 = $httpClient->getResponse();

echo sprintf("%s:%s\n", $httpResponse3->getResponseCode(), $httpResponse3->getResponseStatus());

Expected result:
----------------
201:Created
204:No Content
201:Created

Actual result:
--------------
201:Created
204:No Content
415:Unsupported Media Type

Patches

Pull Requests

History

AllCommentsChangesGit/SVN commitsRelated reports
 [2014-09-23 19:28 UTC] mike@php.net
-Assigned To: +Assigned To: mike
 [2014-09-25 07:22 UTC] mike@php.net
Automatic comment on behalf of mike
Revision: http://git.php.net/?p=pecl/http/pecl_http.git;a=commit;h=d9c22b8c6b2c3f6e2e6feffe77f940b3fe20efe5
Log: Fix bug #68083 PUT method not working after DELETE
 [2014-09-25 07:22 UTC] mike@php.net
-Status: Assigned +Status: Closed
 [2014-09-25 07:23 UTC] mike@php.net
Automatic comment on behalf of mike
Revision: http://git.php.net/?p=pecl/http/pecl_http.git;a=commit;h=d9c22b8c6b2c3f6e2e6feffe77f940b3fe20efe5
Log: Fix bug #68083 PUT method not working after DELETE
 
PHP Copyright © 2001-2024 The PHP Group
All rights reserved.
Last updated: Sat Dec 21 12:01:31 2024 UTC