Package home | Report new bug | New search | Development Roadmap Status: Open | Feedback | All | Closed Since Version 1.4.4

Bug #7922 content-type is removed on mistake
Submitted: 2006-06-16 12:35 UTC
From: ilia_kantor at webamg dot com Assigned: avb
Status: Closed Package: HTTP_Request (version 1.3.0)
PHP Version: 5.1.4 OS: Gentoo Linux
Roadmaps: (Not assigned)    

 [2006-06-16 12:35 UTC] ilia_kantor at webamg dot com (Ilia)
Description: ------------ If I setMethod("PUT") and provide content-type, then _build_request removes content-type from request. POST works fine, but PUT is needed for webservices!


 [2006-06-16 14:25 UTC] avb (Alexey Borzov)
No test script to reproduce the problem.
 [2006-06-16 15:04 UTC] avb (Alexey Borzov)
OK, looks like the bug is real and caused by wrong check for request body starting line 763 Test script: require_once 'HTTP/Request.php'; $req = new HTTP_Request(''); $req->setMethod("PUT"); $req->addHeader("content-type", 'application/x-foobar'); $req->setBody("DATA"); echo $req->_buildRequest();
 [2006-10-08 18:27 UTC] william at sqlcoders dot com (william gogan)
for anyone who's been annoyed by this bug, as it still seems to be in the current distro, the fix is to change line 765 to (HTTP_REQUEST_METHOD_POST == $this->_method && empty($this->_postData) && empty($this->_postFiles))) { (was (HTTP_REQUEST_METHOD_POST != $this->_method && empty($this->_postData) && empty($this->_postFiles))) { ).. it's just that first ! that should be a =
 [2006-10-10 19:33 UTC] avb (Alexey Borzov)
Fixed in CVS. Do not use the solution proposed by william at sqlcoders dot com, since it is broken.