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_Request » Bug #3492

Redirect on Location doesn't work correctly with GET args

Details

Submitted2005-02-16 16:05 UTC
Fromaswl at calluk dot com
StatusWont fix
PackageHTTP_Request
PHP VersionIrrelevant
OSIrrelevant
Roadmaps(Not assigned)

Comments

[2005-02-16 16:05 UTC] aswl at calluk dot com

Description:
------------
When you issue a GET request with a querystring and it gets redirected to another location it appends the query string again even though it gets returned in the location header.

GET /test.aspx?xmldoc=test
Response Code: 302
[Server] => Microsoft-IIS/5.0
[X-Powered-By] => ASP.NET
[X-AspNet-Version] => 1.1.4322
[Location] => /(zdz0ty45blgf2oafdwkwlm55)/test.aspx?xmldoc=test

GET /(zdz0ty45blgf2oafdwkwlm55)/test.aspx?xmldoc=test&xmldoc=test
Response Code: 500

Reproduce code:
---------------
The following will reset the query string for an Absolute Path Redirect, may also affect other forms of redirect.

--- Request.php.orig 2005-02-16 15:27:10.679649521 +0000
+++ Request.php 2005-02-16 15:30:30.516653523 +0000
@@ -623,6 +623,7 @@
// Absolute path
} elseif ($redirect{0} == '/') {
$this->_url->path = $redirect;
+ $this->_url->querystring = array();

// Relative path
} elseif (substr($redirect, 0, 3) == '../' OR substr($redirect, 0, 2) == './') {

Expected result:
----------------
Response Code: 200

With the response body containing the XML result

Actual result:
--------------
The URL is set to the redirect Location header with the original querystring appended.