The result expected is a 200 HTTP status code.
400 HTTP status code because the server doesn't receive the data properly.
Apache Server installed on an Ubuntu machine using PHP v5.3.29
I have seen the code in the libraries folder of Joomla! CMS repository is quite different than the HTTP Package in Joomla Framework. The code in the HTTP package repository works fine. I suggest to update it in the next version because I'm not able to use the JHttp library because I cannot send a PUT request.
Labels |
Removed:
?
|
Labels |
Added:
?
|
Hi Phil,
Thanks for the extra details!
On my end it looks like if we remove these 3 lines (which causes PUT requests to be made using CURLOPT_CUSTOMREQUEST instead of CURLOPT_PUT) it seems to allow it to start working:
https://github.com/joomla/joomla-cms/blob/staging/libraries/joomla/http/transport/curl.php#L77-L79
please comment on #6561 as well and ensure you test the proposed pull request - The pull request will not be merged without people testing...
The reason I leave case 'PUT':
in, is to stop up going through all this again when someone notices its not there, leaving it in, as part of the default block (allowed in PHP) allows us to know in the future that it has been thought about and not just forgot it...
Another option it appears would be to switch out the lines I mention above for the following:
case 'PUT':
$headers['X-HTTP-Method-Override'] = 'PUT';
break;
According to this comment:
http://php.net/manual/en/function.curl-setopt.php#109634
It looks like the framework has opted for the first option I mentioned (using CURLOPT_CUSTOMREQUEST for all types: GET, POST, PUT, DELETE, etc.):
https://github.com/joomla/joomla-framework/blob/staging/src/Joomla/Http/Transport/Curl.php#L67-L68
So that might be the one to go with for consistency.
Thanks for the links to the other issue numbers Phil, it sounds like you came to the same conclusions already and had that PR ready in #6561.
I've confirmed that PR should fix what's mentioned in this issue.
@PhilETaylor (I apologize I wasn't checking my email when your initial reply had come in so I kept on digging and writing replies on on my end before I saw it).
Status | New | ⇒ | Confirmed |
closed as we have a PR #6561
Status | Confirmed | ⇒ | Closed |
Closed_Date | 0000-00-00 00:00:00 | ⇒ | 2015-05-24 10:43:39 |
Closed_By | ⇒ | brianteeman |
Build | 3.4.1 | ⇒ | staging |
I can confirm this as a bug.
Test REST PUT/POST endpoint of http://docs.myjoomla.io/debug/issue/6556 established for your testing purposes. The end point was independently tested with PostMan App to show working PUT request output, and then when tested with JHTTP it failed to return the data sent (http://screenshot.myjoomla.io/image/2O0K2P120c1D)
Furthermore the correct data is not received by the end point as it is never sent correctly by JHTTP
http://screenshot.myjoomla.io/image/1i3Y0J350N3B
Gist that documents/highlights/provides a test case for this is here:
https://gist.github.com/a4ee67f8f48d3674221d