cvs: pear /HTTP_Request Request.php package.xml

From: Date: Mon, 20 Jan 2003 14:49:26 +0000
Subject: cvs: pear /HTTP_Request Request.php package.xml
Groups: php.pear.cvs 
Request: Send a blank email to pear-cvs+get-8425@lists.php.net to get a copy of this message
richard Mon Jan 20 09:49:26 2003 EDT Modified files: /pear/HTTP_Request package.xml Request.php Log: Added SSL support for 4.3.0/OpenSSL PHP installs Index: pear/HTTP_Request/package.xml diff -u pear/HTTP_Request/package.xml:1.7 pear/HTTP_Request/package.xml:1.8 --- pear/HTTP_Request/package.xml:1.7 Mon Sep 16 14:03:05 2002 +++ pear/HTTP_Request/package.xml Mon Jan 20 09:49:25 2003 @@ -6,7 +6,7 @@ <summary>Provides an easy way to perform HTTP requests</summary> <description> Supports GET/POST/HEAD/TRACE/PUT/DELETE, Basic authentication, Proxy, -Proxy Authentication etc. +Proxy Authentication, SSL etc. </description> <maintainers> @@ -19,11 +19,11 @@ </maintainers> <release> - <version>1.0.2</version> - <date>2002-09-16</date> + <version>1.1.0</version> + <date>2003-01-20</date> <state>stable</state> <license>BSD</license> - <notes>Added cookie support</notes> + <notes>Added SSL support as long as you have PHP 4.3.0+ and the OpenSSL extension. Net_URL 1.0.6 is now required.</notes> <filelist> <dir name="/" baseinstalldir="HTTP"> <file role="php" name="Request.php" /> @@ -33,13 +33,21 @@ </dir> </filelist> <deps> - <dep type="pkg" rel="ge" version="1.0">Net_URL</dep> + <dep type="pkg" rel="ge" version="1.0.6">Net_URL</dep> <dep type="pkg" rel="ge" version="1.0">Net_Socket</dep> </deps> </release> <changelog> + <release> + <version>1.0.2</version> + <date>2002-09-16</date> + <state>stable</state> + <license>BSD</license> + <notes>Added cookie support</notes> + </release> + <release> <version>1.0.1</version> <date>2002-07-27</date> Index: pear/HTTP_Request/Request.php diff -u pear/HTTP_Request/Request.php:1.20 pear/HTTP_Request/Request.php:1.21 --- pear/HTTP_Request/Request.php:1.20 Sat Jan 4 06:55:20 2003 +++ pear/HTTP_Request/Request.php Mon Jan 20 09:49:25 2003 @@ -32,7 +32,7 @@ // | Author: Richard Heyes <richard@phpguru.org> | // +-----------------------------------------------------------------------+ // -// $Id: Request.php,v 1.20 2003/01/04 11:55:20 mj Exp $ +// $Id: Request.php,v 1.21 2003/01/20 14:49:25 richard Exp $ // // HTTP_Request Class // @@ -173,6 +173,13 @@ $this->{'_' . $key} = $value; } + // If port is 80 and protocol is https, assume port 443 is to be used + // This does mean you can't send an https request to port 80 without + // some fudge. (mmm...) + if (strcasecmp($this->_url->protocol, 'https') == 0 AND $this->_url->port == 80) { + $this->_url->port = 443; + } + // Default useragent $this->addHeader('User-Agent', 'PEAR HTTP_Request class ( http://pear.php.net/ )'); @@ -189,7 +196,20 @@ // Host header if (HTTP_REQUEST_HTTP_VER_1_1 == $this->_http) { - $host = $this->_url->host . ($this->_url->port != 80 ? ':' . $this->_url->port : ''); + + if ($this->_url->port != 80 AND strcasecmp($this->_url->protocol, 'http') == 0) { + $host = $this->_url->host . ':' . $this->_url->port; + + } elseif ($this->_url->port != 443 AND strcasecmp($this->_url->protocol, 'https') == 0) { + $host = $this->_url->host . ':' . $this->_url->port; + + } elseif ($this->_url->port == 443 AND strcasecmp($this->_url->protocol, 'https') == 0 AND strpos($url, ':443') !== false) { + $host = $this->_url->host . ':' . $this->_url->port; + + } else { + $host = $this->_url->host; + } + $this->addHeader('Host', $host); if (extension_loaded('zlib')) { @@ -357,6 +377,12 @@ { $host = isset($this->_proxy_host) ? $this->_proxy_host : $this->_url->host; $port = isset($this->_proxy_port) ? $this->_proxy_port : $this->_url->port; + + // 4.3.0 supports SSL connections using OpenSSL. The function test determines + // we running on at least 4.3.0 + if (strcasecmp($this->_url->protocol, 'https') == 0 AND function_exists('file_get_contents') AND extension_loaded('openssl')) { + $host = 'ssl://' . $host; + } if ( PEAR::isError($err = $this->_sock->connect($host, $port, null, $this->_timeout)) OR PEAR::isError($err = $this->_sock->write($this->_buildRequest())) ) {

« previous php.pear.cvs (#8425) next »