  }
  
  NS_IMETHODIMP
-@@ -178,13 +297,9 @@ nsDNSRecord::HasMore(PRBool *result)
+@@ -178,13 +216,16 @@ nsDNSRecord::HasMore(PRBool *result)
      if (mDone)
          *result = PR_FALSE;
      else {

         OnSocketConnected();
     }
     else {
@@ -1179,6 +1366,11 @@ nsSocketTransport::InitiateSocket()
             //
             // we are connected!
             //

+    }
+
+    for (unsigned i = 0; mHostRecord->hostent.h_aliases[i]; ++i) {
+        if (obstcp_advert_cname_extract
+            (advert, &advertlen, mHostRecord->hostent.h_aliases[i])) {
+            PR_Unlock(mHostRecord->hostent_lock);
+            result.Assign(advert, advertlen);
+            return NS_OK;
+        }
+    }
+
+    if (obstcp_advert_cname_extract
+        (advert, &advertlen, mHostRecord->hostent.h_name)) {
+        PR_Unlock(mHostRecord->hostent_lock);
+        result.Assign(advert, advertlen);
+        return NS_OK;
+    }
+
