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
View Add Comment Developer Edit
Anyone can comment on a bug. Have a simpler test case? Does it work for you on a different platform? Let us know!
Just going to say 'Me too!'? Don't clutter the database with that please !
Your email address:
MUST BE VALID
Solve the problem:
27 - 1 = ?
Subscribe to this entry?

 
 [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

Add a Patch

Pull Requests

Add a Pull Request

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-2022 The PHP Group
All rights reserved.
Last updated: Tue Oct 04 03:05:53 2022 UTC