From f514dccdf41d775f9847d05f57c9fee3a8be44b2 Mon Sep 17 00:00:00 2001
From: Tim Steiner <tsteiner2@unl.edu>
Date: Wed, 6 Oct 2010 14:48:51 +0000
Subject: [PATCH] My fix to drupal core for http://drupal.org/node/932738 . 
 Hopefully this makes it into the next release.

git-svn-id: file:///tmp/wdn_thm_drupal/branches/drupal-7.x@226 20a16fea-79d4-4915-8869-1ea9d5ebf173
---
 includes/common.inc | 11 +++++++----
 1 file changed, 7 insertions(+), 4 deletions(-)

diff --git a/includes/common.inc b/includes/common.inc
index 3069aff27..5316afad8 100644
--- a/includes/common.inc
+++ b/includes/common.inc
@@ -2092,8 +2092,8 @@ function url($path = NULL, array $options = array()) {
     if ($options['query']) {
       $path .= (strpos($path, '?') !== FALSE ? '&' : '?') . drupal_http_build_query($options['query']);
     }
-    if (isset($options['https']) && variable_get('https', FALSE)) {
-      if ($options['https'] === TRUE) {
+    if (isset($options['https'])) {
+      if (variable_get('https', FALSE) && $options['https'] === TRUE) {
         $path = str_replace('http://', 'https://', $path);
       }
       elseif ($options['https'] === FALSE) {
@@ -2108,8 +2108,8 @@ function url($path = NULL, array $options = array()) {
 
   // The base_url might be rewritten from the language rewrite in domain mode.
   if (!isset($options['base_url'])) {
-    if (isset($options['https']) && variable_get('https', FALSE)) {
-      if ($options['https'] === TRUE) {
+    if (isset($options['https'])) {
+      if (variable_get('https', FALSE) && $options['https'] === TRUE) {
         $options['base_url'] = $base_secure_url;
         $options['absolute'] = TRUE;
       }
@@ -2117,6 +2117,9 @@ function url($path = NULL, array $options = array()) {
         $options['base_url'] = $base_insecure_url;
         $options['absolute'] = TRUE;
       }
+      else {
+        $options['base_url'] = $base_url;
+      }
     }
     else {
       $options['base_url'] = $base_url;
-- 
GitLab