diff options
author | alecpl <alec@alec.pl> | 2009-10-27 09:43:39 +0000 |
---|---|---|
committer | alecpl <alec@alec.pl> | 2009-10-27 09:43:39 +0000 |
commit | 5818e44345204e2323781adb87edcfba45e246a8 (patch) | |
tree | 523983635c190630ae8a57781e3fa1dbbba53798 /program | |
parent | d22f4e67afd40a56db064c571310346bf7acbc55 (diff) |
- Fix $_SERVER['HTTPS'] check for SSL forcing on IIS (#1486243) + fix port check
Diffstat (limited to 'program')
-rw-r--r-- | program/include/main.inc | 21 | ||||
-rw-r--r-- | program/include/rcube_shared.inc | 2 |
2 files changed, 22 insertions, 1 deletions
diff --git a/program/include/main.inc b/program/include/main.inc index 06d7780d1..aa0d3fa26 100644 --- a/program/include/main.inc +++ b/program/include/main.inc @@ -1401,6 +1401,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 */ function check_email($email) diff --git a/program/include/rcube_shared.inc b/program/include/rcube_shared.inc index 97314ccd1..4119f1287 100644 --- a/program/include/rcube_shared.inc +++ b/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: '); } |