From feb1eab8444bf79a6f162156d2614cb0009bbfa2 Mon Sep 17 00:00:00 2001 From: Brion Vibber Date: Mon, 22 Dec 2003 10:21:18 +0000 Subject: [PATCH] Force redirect headers to use absolute URLs as per spec (though browsers seem to accept relative ones); escape the page name on the login cookie check. --- includes/OutputPage.php | 5 +++++ includes/SpecialUserlogin.php | 2 +- 2 files changed, 6 insertions(+), 1 deletion(-) diff --git a/includes/OutputPage.php b/includes/OutputPage.php index 86038f56bf..5dd58a629d 100644 --- a/includes/OutputPage.php +++ b/includes/OutputPage.php @@ -246,6 +246,11 @@ class OutputPage { header( "Content-language: {$wgLanguageCode}" ); if ( "" != $this->mRedirect ) { + if( substr( $this->mRedirect, 0, 4 ) != "http" ) { + # Standards require redirect URLs to be absolute + global $wgServer; + $this->mRedirect = $wgServer . $this->mRedirect; + } header( "Location: {$this->mRedirect}" ); return; } diff --git a/includes/SpecialUserlogin.php b/includes/SpecialUserlogin.php index 584f810737..b18e501a1c 100644 --- a/includes/SpecialUserlogin.php +++ b/includes/SpecialUserlogin.php @@ -386,7 +386,7 @@ $cambutton { global $wgOut, $wgLang; - $check = wfLocalUrl( $wgLang->specialPage( "Userlogin" ), + $check = wfLocalUrl( wfUrlEncode( $wgLang->specialPage( "Userlogin" ) ), "wpCookieCheck=$type" ); return $wgOut->redirect( $check ); -- 2.20.1