cvs: pear /HTTP_Request Request.php
| From: | Alexey Borzov | Date: | Tue, 10 Oct 2006 19:31:01 +0000 |
| Subject: | cvs: pear /HTTP_Request Request.php | ||
| Groups: | php.pear.cvs | ||
| Request: | Send a blank email to pear-cvs+get-42482@lists.php.net to get a copy of this message | ||
avb Tue Oct 10 19:31:01 2006 UTC
Modified files:
/pear/HTTP_Request Request.php
Log:
* Added getUrl() method (request #6589)
* Fixed #7922: Content-Type request header was erroneiusly removed
* Set path to '/' if given url with no path (http://www.example.com) (see bug #8662)
http://cvs.php.net/viewvc.cgi/pear/HTTP_Request/Request.php?r1=1.45&r2=1.46&diff_format=u
Index: pear/HTTP_Request/Request.php
diff -u pear/HTTP_Request/Request.php:1.45 pear/HTTP_Request/Request.php:1.46
--- pear/HTTP_Request/Request.php:1.45 Sat Jun 3 09:53:21 2006
+++ pear/HTTP_Request/Request.php Tue Oct 10 19:31:01 2006
@@ -32,7 +32,7 @@
// | Author: Richard Heyes <richard@phpguru.org> |
// +-----------------------------------------------------------------------+
//
-// $Id: Request.php,v 1.45 2006/06/03 09:53:21 avb Exp $
+// $Id: Request.php,v 1.46 2006/10/10 19:31:01 avb Exp $
//
// HTTP_Request Class
//
@@ -348,8 +348,24 @@
if (HTTP_REQUEST_HTTP_VER_1_1 == $this->_http) {
$this->addHeader('Host', $this->_generateHostHeader());
}
+
+ // set '/' instead of empty path rather than check later (see bug #8662)
+ if (empty($this->_url->path)) {
+ $this->_url->path = '/';
+ }
}
+ /**
+ * Returns the current request URL
+ *
+ * @return string Current request URL
+ * @access public
+ */
+ function getUrl($url)
+ {
+ return empty($this->_url)? '': $this->_url->getUrl();
+ }
+
/**
* Sets a proxy to be used
*
@@ -760,15 +776,15 @@
$host = isset($this->_proxy_host) ? $this->_url->protocol . '://' .
$this->_url->host : '';
$port = (isset($this->_proxy_host) AND $this->_url->port != 80) ? ':' .
$this->_url->port : '';
- $path = (empty($this->_url->path)? '/': $this->_url->path) .
$querystring;
+ $path = $this->_url->path . $querystring;
$url = $host . $port . $path;
$request = $this->_method . ' ' . $url . ' HTTP/' . $this->_http
. "\r\n";
if (in_array($this->_method, $this->_bodyDisallowed) ||
- (HTTP_REQUEST_METHOD_POST != $this->_method && empty($this->_body)) ||
- (HTTP_REQUEST_METHOD_POST != $this->_method && empty($this->_postData)
&& empty($this->_postFiles))) {
-
+ (empty($this->_body) && (HTTP_REQUEST_METHOD_POST != $this->_method ||
+ (empty($this->_postData) && empty($this->_postFiles)))))
+ {
$this->removeHeader('Content-Type');
} else {
if (empty($this->_requestHeaders['content-type'])) {