From 29bf9441a8e4149bc5ccf91e0703784da5657878 Mon Sep 17 00:00:00 2001
From: Steve Cronen-Townsend <committer@crotown.com>
Date: Mon, 16 Jul 2012 20:25:04 -0700
Subject: [PATCH] added the backport of the batch in [1572394]  (i1572394-19.patch) to Drupal 6

---
 includes/language.inc |    8 +++++++-
 1 files changed, 7 insertions(+), 1 deletions(-)

diff --git a/includes/language.inc b/includes/language.inc
index 0409766..58ca9f8 100644
--- a/includes/language.inc
+++ b/includes/language.inc
@@ -22,9 +22,15 @@ function language_initialize() {
       return language_default();
 
     case LANGUAGE_NEGOTIATION_DOMAIN:
+      // Get only the host, not the port.
+      $http_host= $_SERVER['HTTP_HOST'];
+      if (strpos($http_host, ':') !== FALSE) {
+        $http_host_tmp = explode(':', $http_host);
+        $http_host = current($http_host_tmp);
+      }
       foreach ($languages as $language) {
         $parts = parse_url($language->domain);
-        if (!empty($parts['host']) && ($_SERVER['HTTP_HOST'] == $parts['host'])) {
+        if (!empty($parts['host']) && ($http_host == $parts['host'])) {
           return $language;
         }
       }
-- 
1.7.0.6

