From aab26a12a98ca99d956ef24e36c2262938631d73 Mon Sep 17 00:00:00 2001 From: vlakoff Date: Tue, 11 Sep 2012 13:10:21 +0200 Subject: Better server test in redirect() of URL helper "Location" header bugs are specific to IIS; previous test was matching all HTTP servers under Windows. This test isn't perfect yet ($_SERVER['SERVER_SOFTWARE'], which corresponds to the "Server" header of HTTP response, might be missing), but there is no perfect test. "Refresh" method makes the window blank for quite a noticeable time, so let's not affect other servers because of IIS. --- system/helpers/url_helper.php | 2 +- user_guide_src/source/helpers/url_helper.rst | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/system/helpers/url_helper.php b/system/helpers/url_helper.php index 57208c948..b1f5eccf1 100644 --- a/system/helpers/url_helper.php +++ b/system/helpers/url_helper.php @@ -534,7 +534,7 @@ if ( ! function_exists('redirect')) } // IIS environment likely? Use 'refresh' for better compatibility - if (DIRECTORY_SEPARATOR !== '/' && $method === 'auto') + if ($method === 'auto' && isset($_SERVER['SERVER_SOFTWARE']) && strpos($_SERVER['SERVER_SOFTWARE'], 'Microsoft-IIS') !== FALSE) { $method = 'refresh'; } diff --git a/user_guide_src/source/helpers/url_helper.rst b/user_guide_src/source/helpers/url_helper.rst index 305454048..8de7817e4 100644 --- a/user_guide_src/source/helpers/url_helper.rst +++ b/user_guide_src/source/helpers/url_helper.rst @@ -303,7 +303,7 @@ link. The function will build the URL based on your config file values. The optional second parameter allows you to force a particular redirection method. The available methods are "location" or "refresh", with location -being faster but less reliable on Windows servers. The default is "auto", +being faster but less reliable on IIS servers. The default is "auto", which will attempt to intelligently choose the method based on the server environment. -- cgit v1.2.3-24-g4f1b