PEAR is discontinued

This is a static archive preserving historical releases and metadata. No new packages or updates will be published. For updates to existing packages, or to publish new packages, please use Composer and Packagist.

Home » HTTP » HTTP_Client » Bug #5740

may need amendment for inappropriate header responses

Details

Submitted2005-10-21 11:23 UTC
Fromsuteado5963 at rcdtokyo dot com
StatusDuplicate
PackageHTTP_Client
PHP VersionIrrelevant
Roadmaps(Not assigned)

Comments

[2005-10-21 11:23 UTC] suteado5963 at rcdtokyo dot com

Description:
------------
The line 290 of HTTP/Client.php of current version 1.0.0 which is written as "$request->getResponseHeader('Location')" shall be amended as "$request->getResponseHeader('location')" -- the string "location" shall be ALL LOWER-CASE, in case.

As all you know, if the URI given to HTTP_Client responds the status code 301, 302, etc., HTTP_Client automatically redirects its location by default to the new URI which is normally set in "Location" field of the responded header.
Today I found a server that responds the new URI in "location" field if 302, instead of the appropriate one. Now HTTP_Client is unable to find the new URI on every 302 responses of this server simply because it refers to "Location" field.

Test script:
---------------
// reproducible at least as of today.
// would become unreproducible
// if the server would change its setting.

require_once 'HTTP/Client.php';
$client =& new HTTP_Client();
$client->get('http://www.simonsays.com/content/content.cfm?pid=500367');
print_r($client->currentResponse());

Expected result:
----------------
Redirected to http://www.simonsays.com/content/book.cfm?pid=500367 and the responded HTTP status code will be "200 OK".

Actual result:
--------------
At least as of today (unless the server changes its setting), HTTP_Client does not redirect its location with this URI as usual and the final responded HTTP status code is still "302 Found".