 +            obstcp_client_banner(&mObsContext, &iov);
 +            PR_Write(fd, iov.iov_base, iov.iov_len);
 +        }
++
          OnSocketConnected();
      }
      else {
-@@ -1179,6 +1361,11 @@ nsSocketTransport::InitiateSocket()
+@@ -1179,6 +1403,11 @@ nsSocketTransport::InitiateSocket()
              //
              // we are connected!
              //

     nsSocketTransportService *serv = gSocketTransportService;
     NS_RELEASE(serv); // nulls argument
 }
@@ -1155,11 +1304,44 @@ nsSocketTransport::InitiateSocket()
     // 
     // Initiate the connect() to the host...  
     //
+    struct obstcp_keys *const keys = ns_obstcp_get_keys();
+
+    if (mProxyPort == 0 && strlen(mHost.get()) && mPort == 80 && mDNSRecord) {
+        nsCString advert;
+        nsresult r = mDNSRecord->GetAdvert(advert);
+        if (NS_SUCCEEDED(r)) {
+            int newport;
+
+            if (obstcp_advert_base32_parse
+                (advert.get(), advert.Length(),
+                 OBSTCP_ADVERT_OBSPORT, &newport,
+                 OBSTCP_ADVERT_END) &&
+                newport) {
+
+                mNetAddr.inet.port = htons(newport);
+                mObfuscation = 1;
+                PRUint8 random[16];

         }
         else {
diff --git a/netwerk/base/src/nsSocketTransport2.h b/netwerk/base/src/nsSocketTransport2.h
index de4133f..9abf5d1 100644
--- a/netwerk/base/src/nsSocketTransport2.h
+++ b/netwerk/base/src/nsSocketTransport2.h
@@ -56,6 +56,8 @@
