From 9c1091778ec6cef4ed3e12fdb6454c38627eaeb3 Mon Sep 17 00:00:00 2001 From: Jan Schneider Date: Thu, 1 Apr 2010 19:33:57 +0200 Subject: [PATCH] Don't hardcode supported HTTP methods. --- framework/Http/lib/Horde/Http/Request/Peclhttp.php | 18 +++++------------- 1 file changed, 5 insertions(+), 13 deletions(-) diff --git a/framework/Http/lib/Horde/Http/Request/Peclhttp.php b/framework/Http/lib/Horde/Http/Request/Peclhttp.php index feedf9f71..95df64f00 100644 --- a/framework/Http/lib/Horde/Http/Request/Peclhttp.php +++ b/framework/Http/lib/Horde/Http/Request/Peclhttp.php @@ -17,18 +17,6 @@ class Horde_Http_Request_Peclhttp extends Horde_Http_Request_Base { /** - * Map of HTTP methods to HTTP_METH_* constants - * @var array - */ - protected $_httpMethods = array( - 'GET' => HTTP_METH_GET, - 'HEAD' => HTTP_METH_HEAD, - 'POST' => HTTP_METH_POST, - 'PUT' => HTTP_METH_PUT, - 'DELETE' => HTTP_METH_DELETE, - ); - - /** * Map of HTTP authentication schemes from Horde_Http constants to HTTP_AUTH constants. * @var array */ @@ -62,7 +50,11 @@ class Horde_Http_Request_Peclhttp extends Horde_Http_Request_Base */ public function send() { - $httpRequest = new HttpRequest($this->uri, $this->_httpMethods[$this->method]); + if (!defined('HTTP_METH_' . $this->method)) { + throw new Horde_Http_Exception('Method ' . $this->method . ' not supported.'); + } + + $httpRequest = new HttpRequest($this->uri, constant('HTTP_METH_' . $this->method)); $data = $this->data; if (is_array($data)) { -- 2.11.0