MINOR Fixed tests not working on the web side as redirection to https would occur

git-svn-id: svn://svn.silverstripe.com/silverstripe/open/modules/sapphire/branches/2.4@108666 467b73ca-7a2a-4603-9d3b-597d59a354a9
This commit is contained in:
Sean Harvey 2010-07-29 01:40:42 +00:00 committed by Sam Minnee
parent 11e9e2a348
commit 8b8df80ccb

View File

@ -646,10 +646,11 @@ class Director {
if($matched && !isset($_SERVER['HTTPS'])) { if($matched && !isset($_SERVER['HTTPS'])) {
$destURL = str_replace('http:', 'https:', Director::absoluteURL($_SERVER['REQUEST_URI'])); $destURL = str_replace('http:', 'https:', Director::absoluteURL($_SERVER['REQUEST_URI']));
if(!headers_sent()) header("Location: $destURL"); // This coupling to SapphireTest is necessary to test the destination URL and to not interfere with tests
if(SapphireTest::is_running_test()) { if(SapphireTest::is_running_test()) {
return $destURL; return $destURL;
} else { } else {
if(!headers_sent()) header("Location: $destURL");
die("<h1>Your browser is not accepting header redirects</h1><p>Please <a href=\"$destURL\">click here</a>"); die("<h1>Your browser is not accepting header redirects</h1><p>Please <a href=\"$destURL\">click here</a>");
} }
} else { } else {