From ebcae35244418278af9a60731f91a633af924022 Mon Sep 17 00:00:00 2001 From: Dion Hulse Date: Sun, 17 Jan 2010 08:05:58 +0000 Subject: [PATCH] Fix WP_Http_Streams to return a single set of headers in the event of redirections. Fixes #11555 git-svn-id: https://develop.svn.wordpress.org/trunk@12746 602fd350-edb4-49c9-b593-d223f7449a82 --- wp-includes/http.php | 9 +++++++++ 1 file changed, 9 insertions(+) diff --git a/wp-includes/http.php b/wp-includes/http.php index 42a70b9fa1..d14c498f9f 100644 --- a/wp-includes/http.php +++ b/wp-includes/http.php @@ -424,6 +424,15 @@ class WP_Http { $response = array('code' => 0, 'message' => ''); + // If a redirection has taken place, The headers for each page request may have been passed. + // In this case, determine the final HTTP header and parse from there. + for ( $i = count($headers)-1; $i >= 0; $i-- ) { + if ( false === strpos($headers[$i], ':') ) { + $headers = array_splice($headers, $i); + break; + } + } + $cookies = array(); $newheaders = array(); foreach ( $headers as $tempheader ) {