[wp-trac] [WordPress Trac] #11555: HTTP Streams transport returns duplicate headers during redirections
WordPress Trac
wp-trac at lists.automattic.com
Tue Dec 22 07:00:06 UTC 2009
#11555: HTTP Streams transport returns duplicate headers during redirections
--------------------------+-------------------------------------------------
Reporter: dd32 | Owner: dd32
Type: defect (bug) | Status: new
Priority: normal | Milestone: 3.0
Component: General | Version: 2.9
Severity: normal | Keywords: needs-patch
--------------------------+-------------------------------------------------
When using the Streams transport, The Headers returned become doubled up
if a redirection takes place.
Example in the case of 3 redirects:
{{{
<?php
$url = "http://localhost/redirect/?rt=2";
$html = wp_remote_get($url, array('max-redirects' => 7));
echo '<pre>';
var_dump($html);
?>
array(4) {
["headers"]=>
array(7) {
["date"]=>
array(2) {
[0]=>
array(2) {
[0]=>
string(29) "Tue, 22 Dec 2009 06:56:52 GMT"
[1]=>
string(29) "Tue, 22 Dec 2009 06:56:52 GMT"
}
[1]=>
string(29) "Tue, 22 Dec 2009 06:56:52 GMT"
}
["server"]=>
array(2) {
[0]=>
array(2) {
[0]=>
string(31) "Apache/2.2.14 (Win32) PHP/5.3.0"
[1]=>
string(31) "Apache/2.2.14 (Win32) PHP/5.3.0"
}
[1]=>
string(31) "Apache/2.2.14 (Win32) PHP/5.3.0"
}
["x-powered-by"]=>
array(2) {
[0]=>
array(2) {
[0]=>
string(9) "PHP/5.3.0"
[1]=>
string(9) "PHP/5.3.0"
}
[1]=>
string(9) "PHP/5.3.0"
}
["location"]=>
array(2) {
[0]=>
string(19) "/redirect/?rt=2&r=1"
[1]=>
string(19) "/redirect/?rt=2&r=2"
}
["content-length"]=>
array(2) {
[0]=>
array(2) {
[0]=>
string(2) "15"
[1]=>
string(2) "15"
}
[1]=>
string(2) "24"
}
["connection"]=>
array(2) {
[0]=>
array(2) {
[0]=>
string(5) "close"
[1]=>
string(5) "close"
}
[1]=>
string(5) "close"
}
["content-type"]=>
array(2) {
[0]=>
array(2) {
[0]=>
string(9) "text/html"
[1]=>
string(9) "text/html"
}
[1]=>
string(9) "text/html"
}
}
["body"]=>
string(24) "Redirect 2 of 2 is FINAL"
["response"]=>
array(2) {
["code"]=>
string(3) "200"
["message"]=>
string(2) "OK"
}
["cookies"]=>
array(0) {
}
}
}}}
The first Array element of the response for each header is the previous
redirects header... I'll work on a patch in a moment.
--
Ticket URL: <http://core.trac.wordpress.org/ticket/11555>
WordPress Trac <http://core.trac.wordpress.org/>
WordPress blogging software
More information about the wp-trac
mailing list