PEAR is archived and read-only

This mirror preserves historical PEAR package releases and metadata so existing references remain available.

Home » HTTP » HTTP_Request » Bug #4716

support for search method

Details

Request #4716support for search method
Submitted2005-06-30 14:48 UTC
Frompear at tovel dot it
Assignedavb
StatusClosed
PackageHTTP_Request
PHP Version4.3.10
Roadmaps(Not assigned)

Comments

[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";

[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.