[Patch] PEAR::HTTP (Update + Files)
| From: | 11abacus.com) | Date: | Tue, 30 Mar 2004 21:28:22 +0000 |
| Subject: | [Patch] PEAR::HTTP (Update + Files) | ||
| Groups: | php.pear.dev | ||
| Request: | Send a blank email to pear-dev+get-26883@lists.php.net to get a copy of this message | ||
Hi,
This is an update on my previous post. Hopefully, this one will also
have the diff file.
A "couple" of things for PEAR::HTTP module:
* New HTTP::absoluteURI() method to resolve relative URLs.
* HTTP::absoluteURI() takes into account HTTP_HOST and PATH_INFO.
* HTTP::absoluteURL() aliases HTTP::absoluteURI() for some people
are more aware of the "URL" acronym.
* HTTP::absoluteURI() allows to switching protocol. For instance
switching from HTTP to HTTPS on the same host using relative URLs.
Extremely useful feature.
* New implementation of HTTP::negotiateLanguage(). Code is about
twice as fast and provides more features (see below)
* HTTP::negotiateLanguage() can now accept list of language codes as
values of array. Backward compatible with language codes as
indexes (was very awkward to use.)
* HTTP::negotiateLanguage() can now match "fr-CA" sent to browser to
"fr" supported languages. Default is to not do that to be backward
compatible with current version of the package.
* HTTP::negotiateLanguage() can now do case sensitive matches, which
has the positive effect of keeping the cases in $supported..
Default is to not do that to be backward compatible with current
version of the package.
* Fixed a typo in HTTP::head() "raiseError" message (bug #1039).
* Changed some " quotes to ' quotes to speed PHP parsing,
* HTTP::head() can now take a timeout parameter. Default = 10 (seconds)
* HTTP::head() raises an error when called on URLs other than http:://.
* HTTP::Date() can now be called without parameter (current time is
used) or with a string date (i.e. for strtotime()).
* Backward compatibility with older PHP versions that don't support
$_SERVER
* HTTP::redirect() now raise a PEAR::Error (under PHP > 4.3.0) when
HTTP headers are already sent.
* Fixed a bug in HTTP::redirect() and default port numbers.
Redirection to HTTPS running on port 80 or HTTP running on port
443 wouldn't add the port for relative URLs (bug #1040.)
Examples of use of the new absoluteURI: Assume the file test.php is
called from http://www.example.net/php/test.php/some/extra/info?query=yes
<?php
require_once('HTTP.php');
echo HTTP::absoluteURI('sub/folder/there.php');
echo HTTP::absoluteURI('test.php', 'https');
echo HTTP::absoluteURI('../index.php', '', 8080);
echo HTTP::absoluteURI('/download.tgz', 'ftp', '21');
?>
Result:
http://www.example.net/php/sub/folder/there.php
https://www.example.net/php/test.php
http://www.example.net:8080/index.php
ftp://www.example.net/download.tgz
Thanks,
-Philippe
http://www.11abacus.com/