Index: domain.module
===================================================================
RCS file: /cvs/drupal/contributions/modules/domain/domain.module,v
retrieving revision 1.40.2.7
diff -u -r1.40.2.7 domain.module
--- domain.module	20 Apr 2008 22:07:17 -0000	1.40.2.7
+++ domain.module	16 Jun 2008 04:34:06 -0000
@@ -40,8 +40,8 @@
 function domain_init() {
   global $_domain, $conf;
   $_domain = array();
-  // Cribbed from bootstrap.inc -- removes port protocols from the host value.
-  $_subdomain = strtolower(implode('.', array_reverse(explode(':', rtrim($_SERVER['HTTP_HOST'], '.')))));
+  // Removes port protocols from the host value.
+  $_subdomain = strtolower(preg_replace('/:[0-9]+$/', '', rtrim($_SERVER['HTTP_HOST'])));
 
   // Strip the www. off the subdomain, if required by the module settings.
   $raw_domain = $_subdomain;
@@ -538,7 +538,7 @@
   if (substr($_url['path'], -1) != '/') {
     $_url['path'] .= '/';
   }
-  $path = $domain['scheme'] .'://'. $domain['subdomain'] . $_url['path'];
+  $path = $domain['scheme'] .'://'. $domain['subdomain'] . (isset($_url['port']) ? ':'. $_url['port'] : '') . $_url['path'];
   return $path;
 }
 
@@ -546,7 +546,7 @@
  * Determine an absolute path to the current page
  */
 function domain_get_uri($domain) {
-  $path = $domain['scheme'] .'://'. $domain['subdomain'] . request_uri();
+  $path = $domain['path'] . drupal_get_path_alias($_GET['q']);
   return $path;
 }
 
Index: domain_conf/settings_domain_conf.inc
===================================================================
RCS file: /cvs/drupal/contributions/modules/domain/domain_conf/settings_domain_conf.inc,v
retrieving revision 1.4.2.2
diff -u -r1.4.2.2 settings_domain_conf.inc
--- domain_conf/settings_domain_conf.inc	30 Mar 2008 20:42:13 -0000	1.4.2.2
+++ domain_conf/settings_domain_conf.inc	17 Jun 2008 02:01:37 -0000
@@ -30,8 +30,8 @@
 function _domain_conf_load() {
   $check = db_result(db_query("SELECT status FROM {system} WHERE name = 'domain_conf'"));
   if ($check > 0) {
-    // Cribbed from bootstrap.inc -- removes port protocols from the host value.
-    $_subdomain = strtolower(implode('.', array_reverse(explode(':', rtrim($_SERVER['HTTP_HOST'], '.')))));
+    // Removes port protocols from the host value.
+    $_subdomain = strtolower(preg_replace('/:[0-9]+$/', '', rtrim($_SERVER['HTTP_HOST'])));
     // Lookup the active domain against our allowed hosts record.
     $domain = db_fetch_array(db_query("SELECT domain_id FROM {domain} WHERE subdomain = '%s'", $_subdomain));
     // If nothing was found, use the default domain.
Index: domain_prefix/settings_domain_prefix.inc
===================================================================
RCS file: /cvs/drupal/contributions/modules/domain/domain_prefix/settings_domain_prefix.inc,v
retrieving revision 1.4.2.2
diff -u -r1.4.2.2 settings_domain_prefix.inc
--- domain_prefix/settings_domain_prefix.inc	30 Mar 2008 20:42:13 -0000	1.4.2.2
+++ domain_prefix/settings_domain_prefix.inc	17 Jun 2008 02:01:08 -0000
@@ -21,8 +21,8 @@
 function _domain_prefix_load() {
   $check = db_result(db_query("SELECT status FROM {system} WHERE name = 'domain_prefix'"));
   if ($check) {
-    // Cribbed from bootstrap.inc -- removes port protocols from the host value.
-    $_subdomain = strtolower(implode('.', array_reverse(explode(':', rtrim($_SERVER['HTTP_HOST'], '.')))));
+    // Removes port protocols from the host value.
+    $_subdomain = strtolower(preg_replace('/:[0-9]+$/', '', rtrim($_SERVER['HTTP_HOST'])));
     // Lookup the active domain against our allowed hosts record.
     $domain = db_fetch_array(db_query("SELECT domain_id FROM {domain} WHERE subdomain = '%s'", $_subdomain));
     if (isset($domain['domain_id'])) {

