From 2fc16ba6708b298fc5991c7cc3228c56bd64507c Mon Sep 17 00:00:00 2001 From: Brion Vibber Date: Thu, 22 Dec 2011 23:12:44 +0000 Subject: [PATCH] Add comments explaining that the funky multiple Location headers stuff is a CURL artifact, and that the code will need updating if bug 29232 is done (high-level handling of http redirects) Followup r94881, r106948. --- includes/HttpFunctions.php | 4 ++++ tests/phpunit/includes/HttpTest.php | 8 ++++++++ 2 files changed, 12 insertions(+) diff --git a/includes/HttpFunctions.php b/includes/HttpFunctions.php index f25a806d6c..f8e7b37a8d 100644 --- a/includes/HttpFunctions.php +++ b/includes/HttpFunctions.php @@ -591,6 +591,10 @@ class MWHttpRequest { * Relative values of the "Location" header are incorrect as stated in RFC, however they do happen and modern browsers support them. * This function loops backwards through all locations in order to build the proper absolute URI - Marooned at wikia-inc.com * + * Note that the multiple Location: headers are an artifact of CURL -- they + * shouldn't actually get returned this way. Rewrite this when bug 29232 is + * taken care of (high-level redirect handling rewrite). + * * @return string */ public function getFinalUrl() { diff --git a/tests/phpunit/includes/HttpTest.php b/tests/phpunit/includes/HttpTest.php index 07ccfa45d0..263383f19f 100644 --- a/tests/phpunit/includes/HttpTest.php +++ b/tests/phpunit/includes/HttpTest.php @@ -124,6 +124,14 @@ class HttpTest extends MediaWikiTestCase { ); } + /** + * Warning: + * + * These tests are for code that makes use of an artifact of how CURL + * handles header reporting on redirect pages, and will need to be + * rewritten when bug 29232 is taken care of (high-level handling of + * HTTP redirects). + */ function testRelativeRedirections() { $h = new MWHttpRequestTester( 'http://oldsite/file.ext' ); # Forge a Location header -- 2.20.1