applayerpluginsandutils/httpprotocolplugins/httpclient/chttpclienthandler.cpp
branchRCL_3
changeset 53 c59bddbfd7b9
parent 40 a0da872af3fa
--- a/applayerpluginsandutils/httpprotocolplugins/httpclient/chttpclienthandler.cpp	Wed Sep 01 12:21:21 2010 +0100
+++ b/applayerpluginsandutils/httpprotocolplugins/httpclient/chttpclienthandler.cpp	Wed Oct 13 15:09:28 2010 +0300
@@ -653,7 +653,47 @@
 		}
 	return newConnection;
 	}
-
+	
+/*
+*	The below function selects correct NTLM connection manger. Connection manager is associate with a socket.
+*	NTLM protocol needs all authentication messages Negotiate(->),Challenge(<-) and Authorise(->) packets
+*	to be sent on the same port.  In this function, the connection manager is identified by NTLM id which is set
+*	when CHttpResponseParser when 401 unauthorised message is received from ntlm enabled server.
+*	The same iNtlmConnId will be maintained until authentication is successful.	
+*/
+CHttpConnectionManager* CHttpClientHandler::SelectNtlmConnectionL(const CHttpConnectionInfo& aConnectionInfo,RHTTPTransaction aTrans)
+    {
+    
+    TInt ntlmConnId;
+    CHttpConnectionManager* fourthChoice=NULL;
+    _LIT8( KNtlmId, "NTLMConnId" );
+    RStringPool stringPool = aTrans.Session().StringPool();
+    RStringF ntlmId = stringPool.OpenFStringL( KNtlmId );
+   	CleanupClosePushL(ntlmId);
+    THTTPHdrVal value;
+    if (aTrans.PropertySet().Property(ntlmId,value))
+        {
+        ntlmConnId = value.Int();
+        for (TInt i=0;i<iConnectionManagers.Count();i++)
+            {
+            const CHttpConnectionInfo& connectionInfo = iConnectionManagers[i]->ConnectionInfo();
+            if( connectionInfo.HostAndPortMatches(aConnectionInfo) )
+                {
+                if (iConnectionManagers[i]->GetNtlmConnId() ==  ntlmConnId)
+                    {
+                    CleanupStack::PopAndDestroy(&ntlmId);
+										return iConnectionManagers[i];
+                    }
+                }
+            else
+                {
+                fourthChoice = iConnectionManagers[i];
+                }
+            }
+        }
+    CleanupStack::PopAndDestroy(&ntlmId);
+    return fourthChoice;
+    }
 
 CHttpConnectionManager* CHttpClientHandler::SelectTunnelConnectionL(const CHttpConnectionInfo& aConnectionInfo, RHTTPTransaction aTrans, TBool aCanPipeline)
 	{
@@ -767,48 +807,6 @@
 	return manager;
 	}
 
-
-/*
-*   The below function selects correct NTLM connection manger. Connection manager is associate with a socket.
-*   NTLM protocol needs all authentication messages Negotiate(->),Challenge(<-) and Authorise(->) packets
-*   to be sent on the same port.  In this function, the connection manager is identified by NTLM id which is set
-*   when CHttpResponseParser when 401 unauthorised message is received from ntlm enabled server.
-*   The same iNtlmConnId will be maintained until authentication is successful. 
-*/
-CHttpConnectionManager* CHttpClientHandler::SelectNtlmConnectionL(const CHttpConnectionInfo& aConnectionInfo,RHTTPTransaction aTrans)
-    {
-    
-    TInt ntlmConnId;
-    CHttpConnectionManager* fourthChoice=NULL;
-    _LIT8( KNtlmId, "NTLMConnId" );
-    RStringPool stringPool = aTrans.Session().StringPool();
-    RStringF ntlmId = stringPool.OpenFStringL( KNtlmId );
-    THTTPHdrVal value;
-    
-    if (aTrans.PropertySet().Property(ntlmId,value))
-        {
-        ntlmConnId = value.Int();
-        for (TInt i=0;i<iConnectionManagers.Count();i++)
-            {
-            const CHttpConnectionInfo& connectionInfo = iConnectionManagers[i]->ConnectionInfo();
-            if( connectionInfo.HostAndPortMatches(aConnectionInfo) )
-                {
-                if (iConnectionManagers[i]->GetNtlmConnId() ==  ntlmConnId)
-                    {
-                    ntlmId.Close();
-                    return iConnectionManagers[i];
-                    }
-                }
-            else
-                {
-                fourthChoice = iConnectionManagers[i];
-                }
-            }
-        }
-    ntlmId.Close();
-    return fourthChoice;
-    }
-
 TInt CHttpClientHandler::MaxNumConnectionManagers() const
 	{
 	// Has this value been previously cached?
@@ -971,14 +969,14 @@
 		// appropriate host.
 		manager = SelectTunnelConnectionL(*info, aTrans.Transaction(), canPipeline);
 		}
-	else
+	else  
 		{
         THTTPHdrVal value;
         _LIT8( KNtlmStateStr, "NTLMState" );
         RStringPool stringPool = iSession.StringPool();
         RStringF strF = stringPool.OpenFStringL( KNtlmStateStr );
         CleanupClosePushL(strF);
-        if ( aTrans.Transaction().PropertySet().Property( strF, value ) && (value.Int() == ENtlmNegotiate || value.Int() == ENtlmAuthenticate) )
+ 				if ( aTrans.Transaction().PropertySet().Property( strF, value ) && (value.Int() == ENtlmNegotiate || value.Int() == ENtlmAuthenticate) )
             {
             manager = SelectNtlmConnectionL(*info,aTrans.Transaction());
             if (manager == NULL)
@@ -997,8 +995,8 @@
             {
             isNewConnection = SelectConnectionManagerL(*info, aTrans.Transaction(), canPipeline, manager);
             }
-        CleanupStack::PopAndDestroy(&strF);
-        }
+				CleanupStack::PopAndDestroy(&strF);
+		}
 
 	if( manager != NULL )
 		{
@@ -1180,32 +1178,6 @@
 		}
 	}
 
-void CHttpClientHandler::GetSecurityPrefs(MSecurityPolicy*& aSecurityPolicy, TInt& aDialogPref)
-	{
-	// Set the security policy
-	aSecurityPolicy = iSecurityPolicy;
-
-	// Set the dialog info - check the session properties
-	THTTPHdrVal value;
-	RStringF secureDialog = iSession.StringPool().StringF(HTTP::ESecureDialog, iStringTable);
-	TBool hasValue = iSession.ConnectionInfo().Property(secureDialog, value);
-	if( hasValue && value.Type() == THTTPHdrVal::KStrFVal && 
-		value.StrF().Index(iStringTable) == HTTP::EDialogNoPrompt )
-		{
-		// Client has requested to not be prompted
-		aDialogPref = CHttpTransportLayer::ETHttpDialogModeUnattended;
-		}
-	else if ( hasValue && value.Type() == THTTPHdrVal::KStrFVal && 
-	        value.StrF().Index(RHTTPSession::GetTable()) == HTTP::EDialogAutomaticAllowed )
-		{
-        aDialogPref = CHttpTransportLayer::ETHttpDialogModeAllowAutomatic;
-		}
-	else
-		{
-		// The default value - the client will be prompted
-		aDialogPref = CHttpTransportLayer::ETHttpDialogModeAttended;
-		}
-	}
 TBool CHttpClientHandler::ImmediateSocketShutdown()
 	{
 	TBool immediateSocketShutdown = EFalse;
@@ -1243,6 +1215,7 @@
 	return result;
 	}
 
+
 TInt CHttpClientHandler::GetSocketImmediateCloseTimeout()
     {
     THTTPHdrVal value;