Browse Source

Fix false positives when checking for HTTPS in some configurations

master
Chris Smith 13 years ago
parent
commit
d0ce0d14a3
1 changed files with 5 additions and 3 deletions
  1. 5
    3
      urlbuilder.inc.php

+ 5
- 3
urlbuilder.inc.php View File

@@ -198,15 +198,17 @@
198 198
   }
199 199
 
200 200
   public static function getCurrentURL($raw = false) {
201
+   $https = false;
201 202
    $res = 'http';
202 203
 
203
-   if (isset($_SERVER['HTTPS'])) {
204
-    $res = 'https';
204
+   if (isset($_SERVER['HTTPS']) && !empty($_SERVER['HTTPS']) && $_SERVER['HTTPS'] != 'off') {
205
+    $https = true;
206
+    $res .= 's';
205 207
    }
206 208
 
207 209
    $res .= '://' . $_SERVER['SERVER_NAME'];
208 210
 
209
-   if ($_SERVER['SERVER_PORT'] != (isset($_SERVER['HTTPS']) ? 443 : 80)) {
211
+   if ($_SERVER['SERVER_PORT'] != ($https ? 443 : 80)) {
210 212
     $res .= ':' . $_SERVER['SERVER_PORT'];
211 213
    }
212 214
 

Loading…
Cancel
Save