From dc6ed34b205582fc82a27b7e344722e33a237f97 Mon Sep 17 00:00:00 2001 From: alec Date: Tue, 27 Oct 2009 09:43:39 +0000 Subject: - Fix $_SERVER['HTTPS'] check for SSL forcing on IIS (#1486243) + fix port check git-svn-id: https://svn.roundcube.net/trunk@3063 208e9e7b-5314-0410-a742-e7e81cd9613c --- roundcubemail/program/include/main.inc | 21 +++++++++++++++++++++ roundcubemail/program/include/rcube_shared.inc | 2 +- 2 files changed, 22 insertions(+), 1 deletion(-) (limited to 'roundcubemail/program') diff --git a/roundcubemail/program/include/main.inc b/roundcubemail/program/include/main.inc index 06d7780d1..aa0d3fa26 100644 --- a/roundcubemail/program/include/main.inc +++ b/roundcubemail/program/include/main.inc @@ -1400,6 +1400,27 @@ function rcube_html_editor($mode='') } +/** + * Check if working in SSL mode + * + * @param integer HTTPS port number + * @param boolean Enables 'use_https' option checking + */ +function rcube_https_check($port=null, $use_https=true) +{ + global $RCMAIL; + + if (isset($_SERVER['HTTPS']) && $_SERVER['HTTPS'] != 'off') + return true; + if ($port && $_SERVER['SERVER_PORT'] == $port) + return true; + if ($use_https && $RCMAIL->config->get('use_https')) + return true; + + return false; +} + + /** * E-mail address validation */ diff --git a/roundcubemail/program/include/rcube_shared.inc b/roundcubemail/program/include/rcube_shared.inc index 97314ccd1..4119f1287 100644 --- a/roundcubemail/program/include/rcube_shared.inc +++ b/roundcubemail/program/include/rcube_shared.inc @@ -41,7 +41,7 @@ function send_nocacheing_headers() header("Pragma: no-cache"); // We need to set the following headers to make downloads work using IE in HTTPS mode. - if (isset($_SERVER['HTTPS']) || rcmail::get_instance()->config->get('use_https')) { + if (rcube_https_check()) { header('Pragma: '); header('Cache-Control: '); } -- cgit v1.2.3