webservices/wshttpchanneltransportplugin/src/senhttpchannelimpl.cpp
branchRCL_3
changeset 11 6abf3d6055cd
parent 3 b5a195438f6a
child 13 bf3935de63a1
equal deleted inserted replaced
7:7bc6ab9b5bcd 11:6abf3d6055cd
   298     TLSLOG_CLOSE(KSenHttpChannelLogChannelBase);
   298     TLSLOG_CLOSE(KSenHttpChannelLogChannelBase);
   299     }
   299     }
   300 
   300 
   301 TInt CSenHttpChannelImpl::SetIapPrefsL( TUint32 aIapId, TBool aDialogPref, RConnection& aConnection, RSocketServ& aSocketServer )
   301 TInt CSenHttpChannelImpl::SetIapPrefsL( TUint32 aIapId, TBool aDialogPref, RConnection& aConnection, RSocketServ& aSocketServer )
   302    	{
   302    	{
   303    	TLSLOG_FORMAT((KSenHttpChannelLogChannelBase , KNormalLogLevel, _L8("- SetIapPrefsL	, IAP ID (%d)"), aIapId));
   303    	TLSLOG_FORMAT((KSenHttpChannelLogChannelBase , KMinLogLevel, _L8("- SetIapPrefsL	, IAP ID (%d)"), aIapId));
   304    	
   304    	
   305     // Check whether IAP ID is not equal with the one that is currently in effect:
   305     // Check whether IAP ID is not equal with the one that is currently in effect:
   306     if(iExplicitIapDefined && iIapId == aIapId )
   306     if(iExplicitIapDefined && iIapId == aIapId )
   307         {
   307         {
   308         TLSLOG_L(KSenHttpChannelLogChannelBase , KMinLogLevel,"- SetIapPrefsL: Iap Id is same as currently in effect");
   308         TLSLOG_L(KSenHttpChannelLogChannelBase , KMinLogLevel,"- SetIapPrefsL: Iap Id is same as currently in effect");
   473 				extPrefs.SetSnapPurpose(CMManager::ESnapPurposeUnknown);
   473 				extPrefs.SetSnapPurpose(CMManager::ESnapPurposeUnknown);
   474 				extPrefs.SetConnSelectionDialog(EFalse);
   474 				extPrefs.SetConnSelectionDialog(EFalse);
   475 				}
   475 				}
   476 			prefList.AppendL(&extPrefs);
   476 			prefList.AppendL(&extPrefs);
   477 			retVal = aConnection.Start(prefList);
   477 			retVal = aConnection.Start(prefList);
   478 			
   478 			TLSLOG_FORMAT((KSenHttpChannelLogChannelBase , KMinLogLevel, _L8("RConnection Start retval[%d]"), retVal));
   479 			if(retVal == KErrNone)
   479 			if(retVal == KErrNone)
   480 				{
   480 				{
   481 				aConnection.GetIntSetting( _L("IAP\\Id"), iIapId);
   481 				aConnection.GetIntSetting( _L("IAP\\Id"), iIapId);
   482 				TName name;
   482 				TName name;
   483 				retVal = aConnection.Name(name);
   483 				retVal = aConnection.Name(name);
   508     if(iExplicitIapDefined && iSnapId == aSnapId )
   508     if(iExplicitIapDefined && iSnapId == aSnapId )
   509         {
   509         {
   510         TLSLOG_L(KSenHttpChannelLogChannelBase , KMinLogLevel,"- SetSnapPrefsL: Sanp is same as currently in effect");
   510         TLSLOG_L(KSenHttpChannelLogChannelBase , KMinLogLevel,"- SetSnapPrefsL: Sanp is same as currently in effect");
   511         return KErrNone;
   511         return KErrNone;
   512         }
   512         }
   513 		else
   513 	else
   514 			{
   514 		{
   515 			TLSLOG_L(KSenHttpChannelLogChannelBase , KMinLogLevel,"- SetSnapPrefsL: Sanp is different with currently in effect");
   515 		TLSLOG_L(KSenHttpChannelLogChannelBase , KMinLogLevel,"- SetSnapPrefsL: Sanp is different with currently in effect");
   516 			}        
   516 		}
   517 	
   517 	
   518     // Check if socket server (connection) is already open..
   518     // Check if socket server (connection) is already open..
   519     if( iExplicitIapDefined )
   519     if( iExplicitIapDefined )
   520         {
   520         {
   521          // Socket server opened once before for some other IAP
   521          // Socket server opened once before for some other IAP
  1044         }
  1044         }
  1045 
  1045 
  1046     // It is MANDATORY, that at least one Accept header TOKEN exists:
  1046     // It is MANDATORY, that at least one Accept header TOKEN exists:
  1047   if ( tokens.Count()==0 )
  1047   if ( tokens.Count()==0 )
  1048         {
  1048         {
       
  1049         TLSLOG(KSenHttpChannelLogChannelBase , KMinLogLevel,(_L("CSenHttpChannelImpl::AddRequestHeadersL Default Token")));
  1049         TPtrC8* pDefaultToken = new (ELeave) TPtrC8( KSenHttpChannelAcceptHeaderDefault );
  1050         TPtrC8* pDefaultToken = new (ELeave) TPtrC8( KSenHttpChannelAcceptHeaderDefault );
  1050         TInt error = tokens.Append( pDefaultToken );
  1051         TInt error = tokens.Append( pDefaultToken );
  1051         if ( error )
  1052         if ( error )
  1052             {
  1053             {
  1053             delete pDefaultToken;
  1054             delete pDefaultToken;
       
  1055             pDefaultToken = NULL;
  1054             }
  1056             }
  1055         }
  1057         }
  1056     // Http headers
  1058     // Http headers
  1057     TInt headerCount(0);
  1059     TInt headerCount(0);
  1058     RPointerArray<MSenProperty> headersArray;
  1060     RPointerArray<MSenProperty> headersArray;
  1080                     // @InvokeHttpMethodL()
  1082                     // @InvokeHttpMethodL()
  1081                     continue;
  1083                     continue;
  1082                     }
  1084                     }
  1083 
  1085 
  1084                 TPtrC8 value = property->Value();
  1086                 TPtrC8 value = property->Value();
  1085                 TLSLOG_FORMAT((KSenHttpChannelLogChannelBase , KMinLogLevel, _L8("- Adding HTTP HEADER, name: (%S), value: (%S)"),
  1087                 TLSLOG_FORMAT((KSenHttpChannelLogChannelBase , KMinLogLevel, _L8("- Adding HTTP HEADER, name: (%S), value: (%S)"), &name, &value));
  1086                     &name, &value));
       
  1087 
  1088 
  1088                 // Open stringpool strings
  1089                 // Open stringpool strings
  1089                 RStringF headerName = iStringPool.OpenFStringL(name);
  1090                 RStringF headerName = iStringPool.OpenFStringL(name);
  1090                 CleanupClosePushL(headerName);
  1091                 CleanupClosePushL(headerName);
  1091                 RStringF headerValue = iStringPool.OpenFStringL(value);
  1092                 RStringF headerValue = iStringPool.OpenFStringL(value);
  1094                 THTTPHdrVal headerFieldVal;
  1095                 THTTPHdrVal headerFieldVal;
  1095                 headerFieldVal.SetStrF(headerValue);
  1096                 headerFieldVal.SetStrF(headerValue);
  1096                 // Check if the header field value already exists
  1097                 // Check if the header field value already exists
  1097                 TBool fieldValueExists = EFalse;
  1098                 TBool fieldValueExists = EFalse;
  1098                 TInt fieldCount = aHeaders.FieldPartsL(headerName);
  1099                 TInt fieldCount = aHeaders.FieldPartsL(headerName);
  1099                 TLSLOG_FORMAT((KSenHttpChannelLogChannelBase , KMinLogLevel, _L8("Header < %S > field count: %d"), &name,
  1100                 TLSLOG_FORMAT((KSenHttpChannelLogChannelBase , KMinLogLevel, _L8("Header < %S > field count: %d"), &name, fieldCount));
  1100                                         fieldCount));
       
  1101 
  1101 
  1102                 for(TInt j=0; j<fieldCount; j++)
  1102                 for(TInt j=0; j<fieldCount; j++)
  1103                     {
  1103                     {
  1104                     THTTPHdrVal hVal;
  1104                     THTTPHdrVal hVal;
  1105                     TInt retCode = aHeaders.GetField(headerName, j, hVal);
  1105                     TInt retCode = aHeaders.GetField(headerName, j, hVal);
  1117 
  1117 
  1118                 // Add header field
  1118                 // Add header field
  1119                 if(!fieldValueExists)
  1119                 if(!fieldValueExists)
  1120                     {
  1120                     {
  1121                     aHeaders.SetFieldL(headerName, headerFieldVal);
  1121                     aHeaders.SetFieldL(headerName, headerFieldVal);
  1122                     TLSLOG_FORMAT((KSenHttpChannelLogChannelBase , KMinLogLevel, _L8("Header < %S: %S > added"),
  1122                     TLSLOG_FORMAT((KSenHttpChannelLogChannelBase , KMinLogLevel, _L8("Header < %S: %S > added"),&name, &value));
  1123                                        &name, &value));
       
  1124                     }
  1123                     }
  1125 
  1124 
  1126                 // Close stringpool strings
  1125                 // Close stringpool strings
  1127                 CleanupStack::PopAndDestroy(2); // headerValue, headerName
  1126                 CleanupStack::PopAndDestroy(2); // headerValue, headerName
  1128                 }
  1127                 }
  1173 
  1172 
  1174             if(KErrNotFound != retCode)
  1173             if(KErrNotFound != retCode)
  1175                 {
  1174                 {
  1176 #ifdef _SENDEBUG
  1175 #ifdef _SENDEBUG
  1177                 const TDesC8& hValStr = hVal.StrF().DesC();
  1176                 const TDesC8& hValStr = hVal.StrF().DesC();
  1178                 TLSLOG_FORMAT((KSenHttpChannelLogChannelBase , KMinLogLevel, _L8("Accept: %S"),
  1177                 TLSLOG_FORMAT((KSenHttpChannelLogChannelBase , KMinLogLevel, _L8("Accept: %S"), &hValStr));
  1179                                    &hValStr));
       
  1180 #endif // _SENDEBUG
  1178 #endif // _SENDEBUG
  1181                 if(hVal == headerFieldVal)
  1179                 if(hVal == headerFieldVal)
  1182                     {
  1180                     {
  1183                     TLSLOG_FORMAT((KSenHttpChannelLogChannelBase , KMinLogLevel, _L8("Header < Accept: %S > already exists"), &token));
  1181                     TLSLOG_FORMAT((KSenHttpChannelLogChannelBase , KMinLogLevel, _L8("Header < Accept: %S > already exists"), &token));
  1184                     fieldValueExists = ETrue;
  1182                     fieldValueExists = ETrue;
  1934 		    
  1932 		    
  1935     if( handle && !iExplicitIapDefined )
  1933     if( handle && !iExplicitIapDefined )
  1936     	{
  1934     	{
  1937 		// Eventhough IAP was not explicitely set (through Serene API), this
  1935 		// Eventhough IAP was not explicitely set (through Serene API), this
  1938 		// code can check what IAP end-user provided via IAP selection dialog:
  1936 		// code can check what IAP end-user provided via IAP selection dialog:
       
  1937 		TLSLOG_L(KSenHttpChannelLogChannelBase , KMinLogLevel,"CSenHttpChannelImpl::EffectiveIapId: about to call RConnection::GetIntSetting()");
  1939 		_LIT( KIapIdKey, "IAP\\Id" );
  1938 		_LIT( KIapIdKey, "IAP\\Id" );
  1940 	    iConnection.GetIntSetting( KIapIdKey, iIapId);
  1939 	    iConnection.GetIntSetting( KIapIdKey, iIapId);
  1941 	    if ( iIapId > 0 )
  1940 	    if ( iIapId > 0 )
  1942 	    	{
  1941 	    	{
  1943 			TLSLOG_FORMAT((KSenHttpChannelLogChannelBase , KMinLogLevel, _L8("---- GetIntSetting(): retuens IAP(%d)"), iIapId ));
  1942 			TLSLOG_FORMAT((KSenHttpChannelLogChannelBase , KMinLogLevel, _L8("---- GetIntSetting(): retuens IAP(%d)"), iIapId ));