Skip to content

Commit

Permalink
Merge pull request #874 from greezybacon/issue/iis-refresh
Browse files Browse the repository at this point in the history
http: Legacy versions of IIS redirect incorrectly

Reviewed-By: Peter Rotich <[email protected]>
  • Loading branch information
protich committed Jan 3, 2014
2 parents eadeffe + 176af90 commit da3d53a
Showing 1 changed file with 8 additions and 3 deletions.
11 changes: 8 additions & 3 deletions include/class.http.php
Original file line number Diff line number Diff line change
Expand Up @@ -40,10 +40,15 @@ function response($code,$content,$contentType='text/html',$charset='UTF-8') {
print $content;
exit;
}

function redirect($url,$delay=0,$msg='') {

if(strstr($_SERVER['SERVER_SOFTWARE'], 'IIS')){
function redirect($url,$delay=0,$msg='') {

$iis = strpos($_SERVER['SERVER_SOFTWARE'], 'IIS') !== false;
@list($name, $version) = explode('/', $_SERVER['SERVER_SOFTWARE']);
// Legacy code for older versions of IIS that would not emit the
// correct HTTP status and headers when using the `Location`
// header alone
if ($iis && version_compare($version, '7.0', '<')) {
header("Refresh: $delay; URL=$url");
}else{
header("Location: $url");
Expand Down

0 comments on commit da3d53a

Please sign in to comment.