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

Request #4716 support for search method
Submitted: 2005-06-30 14:48 UTC
From: pear at tovel dot it Assigned: avb
Status: Closed Package: HTTP_Request
PHP Version: 4.3.10 OS:
Roadmaps: (Not assigned)    
Subscription  
Comments Add Comment Add patch


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 : 19 + 43 = ?

 
 [2005-06-30 14:48 UTC] pear at tovel dot it
Description: ------------ I try to use this class to perform a SEARCH request to a Webdaw server so I wrote this patch. It works for me and need a review. Reproduce code: --------------- diff -Naur HTTP.1.2.4/Request.php HTTP/Request.php --- HTTP.1.2.4/Request.php 2005-06-30 15:57:48.000000000 +0200 +++ HTTP/Request.php 2005-06-30 16:09:01.000000000 +0200 @@ -54,6 +54,7 @@ define('HTTP_REQUEST_METHOD_DELETE', 'DELETE', true); define('HTTP_REQUEST_METHOD_OPTIONS', 'OPTIONS', true); define('HTTP_REQUEST_METHOD_TRACE', 'TRACE', true); +define('HTTP_REQUEST_METHOD_SEARCH', 'SEARCH', true); /* webdav search method */ define('HTTP_REQUEST_HTTP_VER_1_0', '1.0', true); define('HTTP_REQUEST_HTTP_VER_1_1', '1.1', true); @@ -727,7 +728,7 @@ $request = $this->_method . ' ' . $url . ' HTTP/' . $this->_http . "\r\n"; - if (HTTP_REQUEST_METHOD_POST != $this->_method && HTTP_REQUEST_METHOD_PUT != $this->_method) { + if (HTTP_REQUEST_METHOD_POST != $this->_method && HTTP_REQUEST_METHOD_PUT != $this->_method && HTTP_REQUEST_METHOD_SEARCH != $this->_method) { $this->removeHeader('Content-Type'); } else { if (empty($this->_requestHeaders['Content-Type'])) { @@ -747,7 +748,7 @@ } // No post data or wrong method, so simply add a final CRLF - if ((HTTP_REQUEST_METHOD_POST != $this->_method && HTTP_REQUEST_METHOD_PUT != $this->_method) || + if ((HTTP_REQUEST_METHOD_POST != $this->_method && HTTP_REQUEST_METHOD_PUT != $this->_method && HTTP_REQUEST_METHOD_SEARCH != $this->_method) || (empty($this->_postData) && empty($this->_postFiles))) { $request .= "\r\n";

Comments

 [2005-07-23 05:42 UTC] KyleLanser at yahoo dot ca
Hey, Thankyou for the code, i'm test out the changes now. My own code still isnt working but its getting much farther now. Once its working I'll post the additional changes I had to make to get my use of SEARCH working.
 [2005-07-25 07:00 UTC] pear at tovel dot it
Tip for KyleLanser: use addRawPostData to add you webdav query.
 [2005-11-05 16:26 UTC] avb
WebDAV support is a bit outside the scope of HTTP_Request package, it belongs to WebDAV_Client or the like. Though there are two real problems raised there: hardcoded list of request methods that can have bodies and misleading name of addRawPostData() method. These shall be addressed.
 [2005-11-06 18:35 UTC] avb
Added a new HTTP_Request::setBody() method, deprecated addRawPostdata(). Hopefully the new method's name will be more clear. Also now a list of methods which do not allow bodies is kept (TRACE, currently), any other method will send a request body if such body is set. postData / postFiles are only used for actual POST requests.