Permalink
Browse files

MDL-26480 IIS redirect bug workaround

Credit goes to Zenger Sergey
  • Loading branch information...
1 parent c096042 commit b399e435924ea074250a6fb0bc4fcf731e513cda @skodak skodak committed Mar 13, 2011
Showing with 5 additions and 0 deletions.
  1. +5 −0 lib/weblib.php
View
5 lib/weblib.php
@@ -2468,6 +2468,11 @@ function redirect($url, $message='', $delay=-1) {
$encodedurl = preg_replace('/^.*href="([^"]*)".*$/', "\\1", clean_text('<a href="'.$encodedurl.'" />'));
if ($delay == 0 && !$debugdisableredirect && !headers_sent()) {
+ // workaround for IIS bug http://support.microsoft.com/kb/q176113/
+ if (session_id()) {
+ session_get_instance()->write_close();
+ }
+
//302 might not work for POST requests, 303 is ignored by obsolete clients.
@header($_SERVER['SERVER_PROTOCOL'] . ' 303 See Other');
@header('Location: '.$url);

0 comments on commit b399e43

Please sign in to comment.