--- uc_ssl.module
+++ (clipboard)
@@ -12,7 +12,7 @@
    {
       //If base_url exists and is set to a non-secure protocol while the page being called is secure, allow base_url to be changed to
       //the secure version of the website.  Drupal for some reason doesnt have this logic anywhere for $base_url.
-      if ($_SERVER['HTTPS'] && stristr($GLOBALS['base_url'], 'http://'))
+      if (uc_ssl_is_secure() && stristr($GLOBALS['base_url'], 'http://'))
       {
          $GLOBALS['base_url'] = str_ireplace('http://', 'https://', $GLOBALS['base_url']);
       }
@@ -180,7 +180,7 @@
          //Switch to SSL no matter what the link is if Switch isnt on.
          if (!uc_ssl_switch_to_non_ssl())
          {
-            if (!$_SERVER['HTTPS'] && !uc_ssl_path_match($current_path, $exclude_secured_urls))
+            if (!uc_ssl_is_secure() && !uc_ssl_path_match($current_path, $exclude_secured_urls))
             {
                uc_ssl_http_request('https://'.$_SERVER['HTTP_HOST'].$_SERVER['REQUEST_URI']);
             }
@@ -188,7 +188,7 @@
          else
          {
             //If uc_ssl_switch_to_non_ssl() is enabled then we switch back to non-ssl link for non-cart links.
-            if ($_SERVER['HTTPS'])
+            if (uc_ssl_is_secure())
             {
                //The only exceptions are the links listed in the exclude list by other modules.
                if (uc_ssl_path_match($current_path, $exclude_secured_urls))
@@ -204,7 +204,7 @@
          }
 
          //If on a cart url, use HTTPS and re-post/re-direct to the SSL version of the url.
-         if (!$_SERVER['HTTPS'] && uc_ssl_path_match($current_path, $include_secured_urls) && !uc_ssl_path_match($current_path, $exclude_secured_urls))
+         if (!uc_ssl_is_secure() && uc_ssl_path_match($current_path, $include_secured_urls) && !uc_ssl_path_match($current_path, $exclude_secured_urls))
          {
             uc_ssl_http_request('https://'.$_SERVER['HTTP_HOST'].$_SERVER['REQUEST_URI']);
          }
@@ -230,7 +230,7 @@
    {
       if ($_GET['uc_ssl_check'])
       {
-         if ($_SERVER['HTTPS'])
+         if (uc_ssl_is_secure())
          {
             echo TRUE;
          }
@@ -261,3 +261,10 @@
       echo "</pre>";
    }
 }
+
+/**
+ * Check if the current page is SSL
+ */
+function uc_ssl_is_secure() {
+  return (isset($_SERVER['HTTPS']) && $_SERVER['HTTPS'] == 'on') ? TRUE : FALSE;
+}
