applayerpluginsandutils/httptransportplugins/httptransporthandler/csecuresocketcontroller.cpp
branchRCL_3
changeset 20 a0da872af3fa
parent 19 c0c2f28ace9c
--- a/applayerpluginsandutils/httptransportplugins/httptransporthandler/csecuresocketcontroller.cpp	Tue Aug 31 15:44:10 2010 +0300
+++ b/applayerpluginsandutils/httptransportplugins/httptransporthandler/csecuresocketcontroller.cpp	Wed Sep 01 12:21:21 2010 +0100
@@ -16,10 +16,12 @@
 // User includes
 #include "csecuresocketcontroller.h"
 #include "thttptrlayerpanic.h"
+#include "chttptransportlayer.h"
 #include <x509certext.h>
 #include <securesocket.h>
 #include <ssl_internal.h>
-
+#include <featdiscovery.h>
+#include <featureuids.h>
 
 CSecureSocketController* CSecureSocketController::NewL(TAny* aInitParams)
 /**
@@ -73,17 +75,29 @@
 	{
 	// Create the secure layer
 	if( iTlsSocket == NULL )
-		{
-        iTlsSocket = CSecureSocket::NewL(iSocket, aProtocolVersion);
-        }
-	// Get the security preferences, dialog prompt and security policy
-	TBool dialogPref = ETrue;
+		iTlsSocket = CSecureSocket::NewL(iSocket, aProtocolVersion);
 	MSecurityPolicy* securityPolicy = NULL;
-	iCommsInfoProvider.SecurityPreferences(dialogPref, securityPolicy);
+	
+	TBool allowUntrustedCertificates = EFalse;
 
-	// Dialog preferences
-	if( !dialogPref )
-		User::LeaveIfError(iTlsSocket->SetDialogMode(EDialogModeUnattended));
+	allowUntrustedCertificates = CFeatureDiscovery::IsFeatureSupportedL(NFeature::KFeatureIdFfHttpAllowUntrustedCertificates);
+	// Get the security preferences, dialog prompt and security policy
+	if( allowUntrustedCertificates )
+		{
+		TInt dialogPref( CHttpTransportLayer::ETHttpDialogModeAttended );
+		iCommsInfoProvider.SecurityPreferences(dialogPref, securityPolicy);
+		if ( CHttpTransportLayer::ETHttpDialogModeAllowAutomatic == dialogPref )
+            {
+            User::LeaveIfError(iTlsSocket->SetDialogMode(EDialogModeAllowAutomatic));
+            }
+		}
+	else
+		{
+		TBool dialogPref = ETrue;
+		iCommsInfoProvider.SecurityPreferences(dialogPref, securityPolicy);
+		if( !dialogPref )
+            User::LeaveIfError(iTlsSocket->SetDialogMode(EDialogModeUnattended));
+		}
 
 	// Security policy preferences
 	if( securityPolicy )