Index: tcpslavebase.cpp
===================================================================
RCS file: /home/kde/kdelibs/kio/Attic/tcpslavebase.cpp,v
retrieving revision 1.58.2.13
retrieving revision 1.58.2.14
diff -u -3 -p -r1.58.2.13 -r1.58.2.14
--- tcpslavebase.cpp	12 Nov 2001 01:58:06 -0000	1.58.2.13
+++ tcpslavebase.cpp	14 May 2003 16:30:23 -0000	1.58.2.14
@@ -1,5 +1,5 @@
 /*
- * $Id: tcpslavebase.cpp,v 1.58.2.13 2001/11/12 01:58:06 adawit Exp $
+ * $Id: tcpslavebase.cpp,v 1.58.2.14 2003/05/14 16:30:23 staikos Exp $
  *
  * Copyright (C) 2000 Alex Zepeda <jazepeda@pacbell.net>
  * Copyright (C) 2001 George Staikos <staikos@kde.org>
@@ -348,10 +348,19 @@ int TCPSlaveBase::startTLS()
     d->kssl = new KSSL(false);
     if (!d->kssl->TLSInit()) {
         delete d->kssl;
-				d->kssl = NULL;
+	d->kssl = NULL;
         return -1;
     }
 
+    if ( !d->realHost.isEmpty() )
+    {
+      kdDebug(7029) << "Setting real hostname: " << d->realHost << endl;
+      d->kssl->setPeerHost(d->realHost);
+    } else {
+      kdDebug(7029) << "Setting real hostname: " << d->host << endl;
+      d->kssl->setPeerHost(d->host);
+    }
+
     certificatePrompt();
 
     int rc = d->kssl->connect(m_iSock);
@@ -1017,12 +1026,6 @@ void TCPSlaveBase::setEnableSSLTunnel( b
 
 void TCPSlaveBase::setRealHost( const QString& realHost )
 {
-    // Check if we just transitioned from a SSL over
-    // proxy to regular SSL connection! If so tell that
-    // to the SSL module!
-    if ( !d->realHost.isEmpty() && realHost.isEmpty() )
-      d->kssl->setProxy(false, realHost);
-
     d->realHost = realHost;
 }
 
@@ -1030,14 +1033,19 @@ bool TCPSlaveBase::doSSLHandShake( bool 
 {
     kdDebug(7029) << "TCPSlaveBase::doSSLHandShake: " << endl;
 
-    if ( !d->realHost.isNull() )
-    {
-      kdDebug(7029) << "Setting real hostname: " << d->realHost << endl;
-      d->kssl->setProxy(true, d->realHost);
-    }
+    QString msgHost = d->host;
 
     d->kssl->reInitialize();
     certificatePrompt();
+
+    if ( !d->realHost.isEmpty() )
+    {
+      msgHost = d->realHost;
+    }
+
+    kdDebug(7029) << "Setting real hostname: " << msgHost << endl;
+    d->kssl->setPeerHost(msgHost);
+
     d->status = d->kssl->connect(m_iSock);
     if (d->status < 0) {
         CloseDescriptor();
