webservices/wshttpchanneltransportplugin/src/senhttpchannelimpl.cpp
branchRCL_3
changeset 14 9e96e2676219
parent 10 bf3935de63a1
child 15 32ab7ae9ec94
equal deleted inserted replaced
12:48e9d43c1d7f 14:9e96e2676219
    12 * Contributors:
    12 * Contributors:
    13 *
    13 *
    14 * Description:           
    14 * Description:           
    15 *
    15 *
    16 */
    16 */
    17 
       
    18 
       
    19 
       
    20 
       
    21 
       
    22 
       
    23 
       
    24 
       
    25 
       
    26 
    17 
    27 
    18 
    28 #include <uri8.h>
    19 #include <uri8.h>
    29 #include <es_sock.h>
    20 #include <es_sock.h>
    30 #include <in_sock.h>
    21 #include <in_sock.h>
   183 #endif	
   174 #endif	
   184 
   175 
   185 // Ask IAP from user
   176 // Ask IAP from user
   186 void CSenHttpChannelImpl::ConstructL()
   177 void CSenHttpChannelImpl::ConstructL()
   187     {
   178     {
   188     // Open connection to the file logger server
       
   189     TLSLOG_OPEN(KSenHttpChannelLogChannelBase, KSenHttpChannelLogLevel, KSenHttpChannelLogDir, KSenHttpChannelLogFile);
       
   190     TLSLOG(KSenHttpChannelLogChannelBase , KMinLogLevel,(_L("CSenHttpChannelImpl::ConstructL - Log file opened")));
       
   191 
       
   192     // Open the RHTTPSession
   179     // Open the RHTTPSession
   193     TLSLOG(KSenHttpChannelLogChannelBase , KMinLogLevel,(_L("- Opening HTTP/TCP session.")));
   180     TLSLOG(KSenHttpChannelLogChannelBase , KMinLogLevel,(_L("- Opening HTTP/TCP session.")));
   194 
   181 
   195     iSess.OpenL();
   182     iSess.OpenL();
   196 
   183 
   250 //    RSocketServ server; // with "anon" (local) socket servers, should we keep array of open ones in case of pending txns?
   237 //    RSocketServ server; // with "anon" (local) socket servers, should we keep array of open ones in case of pending txns?
   251 //    SetIapPrefsL(aIapId, iConnection, server);
   238 //    SetIapPrefsL(aIapId, iConnection, server);
   252 #ifndef __ENABLE_ALR__
   239 #ifndef __ENABLE_ALR__
   253 	IsOCCImplementedSDK();
   240 	IsOCCImplementedSDK();
   254 #endif	
   241 #endif	
   255 
   242 	if(aIapId > 0)
   256     const TInt result = SetIapPrefsL(aIapId, ETrue, iConnection, iSockServ);
   243 		{
   257     User::LeaveIfError( result );
   244     	const TInt result = SetIapPrefsL(aIapId, ETrue, iConnection, iSockServ);
   258     
   245     	User::LeaveIfError( result );
       
   246     	}
   259     }
   247     }
   260 
   248 
   261 CSenHttpChannelImpl::~CSenHttpChannelImpl()
   249 CSenHttpChannelImpl::~CSenHttpChannelImpl()
   262     {
   250     {
   263     TLSLOG_L(KSenHttpChannelLogChannelBase , KMinLogLevel,"CSenHttpChannelImpl::~CSenHttpChannelImpl()");
   251     TLSLOG_L(KSenHttpChannelLogChannelBase , KMinLogLevel,"CSenHttpChannelImpl::~CSenHttpChannelImpl()");
   290         REComSession::DestroyedImplementation(KDeflateFilterUid); 	
   278         REComSession::DestroyedImplementation(KDeflateFilterUid); 	
   291         }
   279         }
   292         
   280         
   293     iConnection.Close();
   281     iConnection.Close();
   294     iSockServ.Close();
   282     iSockServ.Close();
   295 
   283     TLSLOG_L(KSenHttpChannelLogChannelBase , KMinLogLevel,"CSenHttpChannelImpl::~CSenHttpChannelImpl() Completed");
   296     // Close the log file and the connection to the server.
       
   297     TLSLOG(KSenHttpChannelLogChannelBase , KMinLogLevel,(_L("Log file closed.")));
       
   298     TLSLOG_CLOSE(KSenHttpChannelLogChannelBase);
       
   299     }
   284     }
   300 
   285 
   301 TInt CSenHttpChannelImpl::SetIapPrefsL( TUint32 aIapId, TBool aDialogPref, RConnection& aConnection, RSocketServ& aSocketServer )
   286 TInt CSenHttpChannelImpl::SetIapPrefsL( TUint32 aIapId, TBool aDialogPref, RConnection& aConnection, RSocketServ& aSocketServer )
   302    	{
   287    	{
   303    	TLSLOG_FORMAT((KSenHttpChannelLogChannelBase , KMinLogLevel, _L8("- SetIapPrefsL	, IAP ID (%d)"), aIapId));
   288    	TLSLOG_FORMAT((KSenHttpChannelLogChannelBase , KMinLogLevel, _L8("- SetIapPrefsL	, aIapId (%d)"), aIapId));
       
   289    	TLSLOG_FORMAT((KSenHttpChannelLogChannelBase , KMinLogLevel, _L8("- SetIapPrefsL	, iIapId (%d)"), iIapId));
   304    	
   290    	
   305     // Check whether IAP ID is not equal with the one that is currently in effect:
   291     // Check whether IAP ID is not equal with the one that is currently in effect:
   306     if(iExplicitIapDefined && iIapId == aIapId )
   292     if(iExplicitIapDefined || iIapId == aIapId && iIapId > 0)
   307         {
   293         {
   308         TLSLOG_L(KSenHttpChannelLogChannelBase , KMinLogLevel,"- SetIapPrefsL: Iap Id is same as currently in effect");
   294         TLSLOG_L(KSenHttpChannelLogChannelBase , KMinLogLevel,"- SetIapPrefsL: Iap Id is same as currently in effect");
   309         return KErrNone;
   295         return KErrNone;
   310         }
   296         }
   311 	else
   297 	else
   321         TLSLOG_L(KSenHttpChannelLogChannelBase , KMinLogLevel,"- SetIapPrefsL: Re-using existing RConnection => calling RConnection::Stop");
   307         TLSLOG_L(KSenHttpChannelLogChannelBase , KMinLogLevel,"- SetIapPrefsL: Re-using existing RConnection => calling RConnection::Stop");
   322         aConnection.Stop();
   308         aConnection.Stop();
   323         }
   309         }
   324     else
   310     else
   325         {
   311         {
   326         // Connect to a socket server    
   312         if(aConnection.SubSessionHandle())
   327         TLSLOG_L(KSenHttpChannelLogChannelBase , KMinLogLevel,"- SetIapPrefsL: Connecting to new socket server");    
   313         	{
   328         User::LeaveIfError( aSocketServer.Connect() );       
   314             TLSLOG_L(KSenHttpChannelLogChannelBase , KMinLogLevel,"- SetSnapPrefsL: Re-using existing RConnection => calling RConnection::Stop");
   329 
   315         	aConnection.Stop();
   330         // Open new connection
   316         	}
   331         TLSLOG_L(KSenHttpChannelLogChannelBase , KMinLogLevel,"- SetIapPrefsL: Opening new RConnection using the socket server.");       
   317         else
   332         User::LeaveIfError( aConnection.Open(aSocketServer) ); 
   318             {
       
   319             // Connect to a socket server    
       
   320             TLSLOG_L(KSenHttpChannelLogChannelBase , KMinLogLevel,"- SetIapPrefsL: Connecting to new socket server");    
       
   321             User::LeaveIfError( aSocketServer.Connect() );       
       
   322     
       
   323             // Open new connection
       
   324             TLSLOG_L(KSenHttpChannelLogChannelBase , KMinLogLevel,"- SetIapPrefsL: Opening new RConnection using the socket server.");       
       
   325             User::LeaveIfError( aConnection.Open(aSocketServer) );        
       
   326             }
   333         }
   327         }
   334         
   328         
   335     // Set the IAP selection preferences (IAP ID, do not prompt)    
   329     // Set the IAP selection preferences (IAP ID, do not prompt)    
   336 	TInt retVal = SetID(aIapId, aDialogPref, aConnection, aSocketServer);	        
   330 	TInt retVal = SetID(aIapId, aDialogPref, aConnection, aSocketServer);	        
   337 	
   331 	
   417 			TExtendedConnPref extPrefs;
   411 			TExtendedConnPref extPrefs;
   418 			//extPrefs.SetSnapPurpose( CMManager::ESnapPurposeUnknown);
   412 			//extPrefs.SetSnapPurpose( CMManager::ESnapPurposeUnknown);
   419 			//TLSLOG_L(KSenHttpChannelLogChannelBase , KMinLogLevel, "- Setting up OCC Silent Connection");
   413 			//TLSLOG_L(KSenHttpChannelLogChannelBase , KMinLogLevel, "- Setting up OCC Silent Connection");
   420 			//extPrefs.SetNoteBehaviour(TExtendedConnPref::ENoteBehaviourConnSilent);
   414 			//extPrefs.SetNoteBehaviour(TExtendedConnPref::ENoteBehaviourConnSilent);
   421 			//extPrefs.SetBearerSet(TExtendedConnBearer::EExtendedConnBearerUnknown);
   415 			//extPrefs.SetBearerSet(TExtendedConnBearer::EExtendedConnBearerUnknown);
   422 			extPrefs.SetIapId(aId);
   416 			if(aId != 0)
   423 			extPrefs.SetSnapId(0);
   417 				{
       
   418 				extPrefs.SetIapId(aId);
       
   419 				extPrefs.SetSnapId(0);
       
   420 				}
       
   421 			else
       
   422 				{
       
   423 				extPrefs.SetSnapPurpose(CMManager::ESnapPurposeInternet);
       
   424 				extPrefs.SetConnSelectionDialog(ETrue);
       
   425 				}
   424 			prefList.AppendL(&extPrefs);
   426 			prefList.AppendL(&extPrefs);
   425 			retVal = aConnection.Start(prefList);
   427 			retVal = aConnection.Start(prefList);
   426 			if(retVal == KErrNone)
   428 			if(retVal == KErrNone)
   427 			    {
   429 			    {
   428 			    iIapId = aId;
   430 			    if(aId == 0)
       
   431 			    	{
       
   432                     aConnection.GetIntSetting( _L("IAP\\Id"), iIapId);
       
   433                     TName name;
       
   434                     retVal = aConnection.Name(name);
       
   435                     if(retVal == KErrNone)
       
   436                         {
       
   437                         TLSLOG_FORMAT((KSenHttpChannelLogChannelBase , KMinLogLevel, _L8("IAP Name [%S]"), &name));
       
   438                         }
       
   439                     TLSLOG_FORMAT((KSenHttpChannelLogChannelBase , KMinLogLevel, _L8("GetIntSetting returned IAP [%d]"), iIapId));			    
       
   440 			    	}
       
   441 			    else
       
   442 			    	{	
       
   443 			    	iIapId = aId;
       
   444 			    	}
   429 			    }
   445 			    }
   430 			 else
   446 			 else
   431 			    {
   447 			    {
   432 				TLSLOG_FORMAT((KSenHttpChannelLogChannelBase , KMinLogLevel, _L8("IAP ->Start retVal [%d]"), retVal));
   448                 TLSLOG_FORMAT((KSenHttpChannelLogChannelBase , KMinLogLevel, _L8("IAP ->Start retVal [%d]"), retVal));
   433 			    }
   449 			    }
   434 		    }
   450 		    }
   435 		else
   451 		else
   436 		    {
   452 		    {
   437 		    /**
   453 		    /**
   455 			if(aId == 0)
   471 			if(aId == 0)
   456 				{
   472 				{
   457 				TLSLOG_L(KSenHttpChannelLogChannelBase , KMinLogLevel, "- Setting SnapPurpose Internet");
   473 				TLSLOG_L(KSenHttpChannelLogChannelBase , KMinLogLevel, "- Setting SnapPurpose Internet");
   458 				if(aDialogPref) //If it fails because of unavailibility of access points
   474 				if(aDialogPref) //If it fails because of unavailibility of access points
   459 					{
   475 					{
       
   476 					TLSLOG_L(KSenHttpChannelLogChannelBase , KMinLogLevel, "- Fails because of unavailibility of access points");
   460 					extPrefs.SetSnapPurpose(CMManager::ESnapPurposeUnknown);
   477 					extPrefs.SetSnapPurpose(CMManager::ESnapPurposeUnknown);
   461 					extPrefs.SetConnSelectionDialog(ETrue);
   478 					extPrefs.SetConnSelectionDialog(ETrue);
   462 					}
   479 					}
   463 				else
   480 				else
   464 					{
   481 					{
   472 				extPrefs.SetIapId(0);	
   489 				extPrefs.SetIapId(0);	
   473 				extPrefs.SetSnapPurpose(CMManager::ESnapPurposeUnknown);
   490 				extPrefs.SetSnapPurpose(CMManager::ESnapPurposeUnknown);
   474 				extPrefs.SetConnSelectionDialog(EFalse);
   491 				extPrefs.SetConnSelectionDialog(EFalse);
   475 				}
   492 				}
   476 			prefList.AppendL(&extPrefs);
   493 			prefList.AppendL(&extPrefs);
       
   494 			TLSLOG_L(KSenHttpChannelLogChannelBase , KMinLogLevel, "SetID: RConnection Start");
   477 			retVal = aConnection.Start(prefList);
   495 			retVal = aConnection.Start(prefList);
   478 			TLSLOG_FORMAT((KSenHttpChannelLogChannelBase , KMinLogLevel, _L8("RConnection Start retval[%d]"), retVal));
   496 			TLSLOG_FORMAT((KSenHttpChannelLogChannelBase , KMinLogLevel, _L8("RConnection Start retval[%d]"), retVal));
   479 			if(retVal == KErrNone)
   497 			if(retVal == KErrNone)
   480 				{
   498 				{
   481 				aConnection.GetIntSetting( _L("IAP\\Id"), iIapId);
   499 				aConnection.GetIntSetting( _L("IAP\\Id"), iIapId);
   492 				TLSLOG_FORMAT((KSenHttpChannelLogChannelBase , KMinLogLevel, _L8("SNAP ->Start retVal [%d]"), retVal));
   510 				TLSLOG_FORMAT((KSenHttpChannelLogChannelBase , KMinLogLevel, _L8("SNAP ->Start retVal [%d]"), retVal));
   493 			    }				
   511 			    }				
   494 		    }
   512 		    }
   495 		}    
   513 		}    
   496 #endif    
   514 #endif    
   497     if (!retVal)
   515     if (!retVal && !aSNAP)
   498         {
   516         {
   499         iExplicitIapDefined = ETrue;
   517         iExplicitIapDefined = ETrue;
   500         }	
   518         }	
   501 	return retVal;
   519 	return retVal;
   502 }
   520 }
   503 
   521 
   504 TInt CSenHttpChannelImpl::SetSnapPrefsL( TUint32 aSnapId, TBool aDialogPref, RConnection& aConnection, RSocketServ& aSocketServer )
   522 TInt CSenHttpChannelImpl::SetSnapPrefsL( TUint32 aSnapId, TBool aDialogPref, RConnection& aConnection, RSocketServ& aSocketServer )
   505     {
   523     {
   506     TLSLOG_FORMAT((KSenHttpChannelLogChannelBase , KMinLogLevel, _L8("- CSenHttpChannelImpl::SetSnapPrefsL, SNAP ID (%d)"), aSnapId));
   524     TLSLOG_FORMAT((KSenHttpChannelLogChannelBase , KMinLogLevel, _L8("- CSenHttpChannelImpl::SetSnapPrefsL, SNAP ID (%d)"), aSnapId));
   507 		// Check whether SNAP ID is not equal with the one that is currently in effect:
   525 		// Check whether SNAP ID is not equal with the one that is currently in effect:
   508     if(iExplicitIapDefined && iSnapId == aSnapId )
   526     if(iExplicitIapDefined && iSnapId == aSnapId)
   509         {
   527         {
   510         TLSLOG_L(KSenHttpChannelLogChannelBase , KMinLogLevel,"- SetSnapPrefsL: Sanp is same as currently in effect");
   528         TLSLOG_L(KSenHttpChannelLogChannelBase , KMinLogLevel,"- SetSnapPrefsL: Sanp is same as currently in effect");
   511         return KErrNone;
   529         return KErrNone;
   512         }
   530         }
   513 	else
   531 	else
   522         TLSLOG_L(KSenHttpChannelLogChannelBase , KMinLogLevel,"- SetSnapPrefsL: Re-using existing RConnection => calling RConnection::Stop");
   540         TLSLOG_L(KSenHttpChannelLogChannelBase , KMinLogLevel,"- SetSnapPrefsL: Re-using existing RConnection => calling RConnection::Stop");
   523         aConnection.Stop();
   541         aConnection.Stop();
   524         }
   542         }
   525     else
   543     else
   526         {
   544         {
   527         // Connect to a socket server    
   545         if(aConnection.SubSessionHandle())
   528         TLSLOG_L(KSenHttpChannelLogChannelBase , KMinLogLevel,"- SetSnapPrefsL: Connecting to new socket server");    
   546         	{
   529         User::LeaveIfError( aSocketServer.Connect() );       
   547             TLSLOG_L(KSenHttpChannelLogChannelBase , KMinLogLevel,"- SetSnapPrefsL: Re-using existing RConnection => calling RConnection::Stop");
   530 
   548         	aConnection.Stop();
   531         // Open new connection
   549         	}
   532         TLSLOG_L(KSenHttpChannelLogChannelBase , KMinLogLevel,"- SetSnapPrefsL: Opening new RConnection using the socket server.");       
   550         else
   533         User::LeaveIfError( aConnection.Open(aSocketServer) ); 
   551             {
       
   552             // Connect to a socket server    
       
   553             TLSLOG_L(KSenHttpChannelLogChannelBase , KMinLogLevel,"- SetSnapPrefsL: Connecting to new socket server");    
       
   554             User::LeaveIfError( aSocketServer.Connect() );       
       
   555     
       
   556             // Open new connection
       
   557             TLSLOG_L(KSenHttpChannelLogChannelBase , KMinLogLevel,"- SetSnapPrefsL: Opening new RConnection using the socket server.");       
       
   558             User::LeaveIfError( aConnection.Open(aSocketServer) );         
       
   559             }
   534         }
   560         }
   535         
   561         
   536         
   562         
   537 	// Set the SNAP selection preferences (SNAP ID, do not prompt)    
   563 	// Set the SNAP selection preferences (SNAP ID, do not prompt)    
   538 	TInt retVal = SetID(aSnapId, aDialogPref, aConnection, aSocketServer, ETrue);
   564 	TInt retVal = SetID(aSnapId, aDialogPref, aConnection, aSocketServer, ETrue);
   555                                                 
   581                                                 
   556     // Remember the SNAP id that is being set, because *at the moment*,
   582     // Remember the SNAP id that is being set, because *at the moment*,
   557     // there is NO direct API to query effective SNAP ID from CommsDB.
   583     // there is NO direct API to query effective SNAP ID from CommsDB.
   558     if (!retVal)
   584     if (!retVal)
   559         {
   585         {
   560         iExplicitIapDefined = ETrue;
   586         //iExplicitIapDefined = ETrue;
   561         iSnapId = aSnapId;
   587         iSnapId = aSnapId;
   562         }
   588         }
   563     return retVal;
   589     return retVal;
   564     }
   590     }
   565 
   591 
   695         {
   721         {
   696         // by default, do not prompt (even if property does not exist!) 
   722         // by default, do not prompt (even if property does not exist!) 
   697         // => only if property is set, and has value "FALSE", show PROMPT            
   723         // => only if property is set, and has value "FALSE", show PROMPT            
   698         prompt = ETrue;
   724         prompt = ETrue;
   699         }
   725         }
   700 
   726 	TLSLOG_FORMAT((KSenHttpChannelLogChannelBase , KMinLogLevel, _L8("CSenHttpChannelImpl::InvokeHttpMethodL - iIapId [%d]"), iIapId)); 
   701 #ifndef __ENABLE_ALR__
   727 #ifndef __ENABLE_ALR__
       
   728 		TInt propRetVal = aProps.IapIdL(id);
   702     // Independent of dialog preference (property's existance), if IAP was predefined, it must be set        
   729     // Independent of dialog preference (property's existance), if IAP was predefined, it must be set        
   703     if(((aProps.IapIdL(id)) == KErrNone))
   730     if(propRetVal == KErrNone)
   704         {
   731         {
       
   732         TLSLOG_FORMAT((KSenHttpChannelLogChannelBase , KMinLogLevel, _L8("CSenHttpChannelImpl::InvokeHttpMethodL SetIapPrefs - id [%d]"), id));
   705         retVal = SetIapPrefsL(id, prompt, iConnection, iSockServ);
   733         retVal = SetIapPrefsL(id, prompt, iConnection, iSockServ);
       
   734         }
       
   735     else if(iIapId > 0)
       
   736         {
       
   737         TLSLOG_FORMAT((KSenHttpChannelLogChannelBase , KMinLogLevel, _L8("CSenHttpChannelImpl::InvokeHttpMethodL SetIapPrefs - iIapId [%d]"), iIapId)); 
       
   738         retVal = SetIapPrefsL(iIapId, prompt, iConnection, iSockServ);
   706         }
   739         }
   707     else if(((aProps.SnapIdL(id)) == KErrNone))
   740     else if(((aProps.SnapIdL(id)) == KErrNone))
   708         {
   741         {
   709         retVal = SetSnapPrefsL(id, prompt, iConnection, iSockServ);
   742         retVal = SetSnapPrefsL(id, prompt, iConnection, iSockServ);
   710         }
   743         }
   724             }
   757             }
   725         }
   758         }
   726     TLSLOG_FORMAT((KSenHttpChannelLogChannelBase , KMinLogLevel, _L8("Set Snap/IAP prefs retVal [%d]"), retVal));    
   759     TLSLOG_FORMAT((KSenHttpChannelLogChannelBase , KMinLogLevel, _L8("Set Snap/IAP prefs retVal [%d]"), retVal));    
   727     User::LeaveIfError(retVal);
   760     User::LeaveIfError(retVal);
   728     TLSLOG_L(KSenHttpChannelLogChannelBase , KMinLogLevel,"CSenHttpChannelImpl::InvokeHttpMethodL After User::Leave");
   761     TLSLOG_L(KSenHttpChannelLogChannelBase , KMinLogLevel,"CSenHttpChannelImpl::InvokeHttpMethodL After User::Leave");
   729     TInt ret= iConnection.GetIntSetting(_L("IAP\\Id"), iUsedIapId);
   762     //TInt ret= iConnection.GetIntSetting(_L("IAP\\Id"), iUsedIapId);
       
   763     iUsedIapId = iIapId;
   730     // Check transport properties
   764     // Check transport properties
   731     TLSLOG_FORMAT((KSenHttpChannelLogChannelBase , KMinLogLevel, _L8("IAP/SNAP %d"), id));
   765     TLSLOG_FORMAT((KSenHttpChannelLogChannelBase , KMinLogLevel, _L8("IAP/SNAP %d"), id));
   732 #else
   766 #else
   733 	retVal = SetIapPrefsL(id, prompt, iConnection, iSockServ);
   767 	retVal = SetIapPrefsL(id, prompt, iConnection, iSockServ);
   734 	TLSLOG_FORMAT((KSenHttpChannelLogChannelBase , KMinLogLevel, _L8("IAP/SNAP %d"), id));	
   768 	TLSLOG_FORMAT((KSenHttpChannelLogChannelBase , KMinLogLevel, _L8("IAP/SNAP %d"), id));	
  1586     }
  1620     }
  1587 
  1621 
  1588 void CSenHttpChannelImpl::HandleRunErrorL(RHTTPTransaction aTransaction,
  1622 void CSenHttpChannelImpl::HandleRunErrorL(RHTTPTransaction aTransaction,
  1589                                           TInt aError)
  1623                                           TInt aError)
  1590     {
  1624     {
       
  1625     TLSLOG_L(KSenHttpChannelLogChannelBase , KMaxLogLevel,"CSenHttpChannelImpl::HandleRunErrorL()");
  1591     TInt txnId = aTransaction.Id();
  1626     TInt txnId = aTransaction.Id();
  1592     TLSLOG_FORMAT((KSenHttpChannelLogChannelBase , KMinLogLevel, _L8("CSenHttpChannelImpl::HandleRunErrorL( %d ): %d"),txnId, aError));
  1627     TLSLOG_FORMAT((KSenHttpChannelLogChannelBase , KMinLogLevel, _L8("CSenHttpChannelImpl::HandleRunErrorL( %d ): %d"),txnId, aError));
  1593     CSenTxnState* pTxnState = FindTxnState(txnId);
  1628     CSenTxnState* pTxnState = FindTxnState(txnId);
  1594     __ASSERT_ALWAYS(pTxnState != NULL,
  1629     __ASSERT_ALWAYS(pTxnState != NULL,
  1595                     User::Panic(KTxnStateNullPanicText,
  1630                     User::Panic(KTxnStateNullPanicText,
  1596                     CSenHttpChannel::ETxnStateNull));
  1631                     CSenHttpChannel::ETxnStateNull));
  1597 
  1632 
  1598     pTxnState->ResponseErrorL(aError);
  1633     pTxnState->ResponseErrorL(aError);
  1599     DeleteTxnState(txnId);
  1634     DeleteTxnState(txnId);
  1600     aTransaction.Close();
  1635     aTransaction.Close();
       
  1636     TLSLOG_L(KSenHttpChannelLogChannelBase , KMaxLogLevel,"CSenHttpChannelImpl::HandleRunErrorL() Completed");
  1601     }
  1637     }
  1602 
  1638 
  1603 void CSenHttpChannelImpl::HandleRedirectRequiresConfirmationL(
  1639 void CSenHttpChannelImpl::HandleRedirectRequiresConfirmationL(
  1604                                                 RHTTPTransaction aTransaction)
  1640                                                 RHTTPTransaction aTransaction)
  1605     {
  1641     {
  1903     }
  1939     }
  1904 
  1940 
  1905 
  1941 
  1906 TBool CSenHttpChannelImpl::EffectiveIapId( TUint32 &aIapId )
  1942 TBool CSenHttpChannelImpl::EffectiveIapId( TUint32 &aIapId )
  1907     {
  1943     {
  1908 	TInt handle = iConnection.SubSessionHandle();
  1944     /*
       
  1945 		TInt handle = iConnection.SubSessionHandle();
  1909 		if (handle>0)
  1946 		if (handle>0)
  1910 		    {
  1947 		    {
  1911 			TLSLOG_FORMAT((KSenHttpChannelLogChannelBase , KMinLogLevel, _L8("CSenHttpChannelImpl::EffectiveIapId(): Current RConnection's subsession handle(%d)"), handle ));	    
  1948 				TLSLOG_FORMAT((KSenHttpChannelLogChannelBase , KMinLogLevel, _L8("CSenHttpChannelImpl::EffectiveIapId(): Current RConnection's subsession handle(%d)"), handle ));	    
  1912 	        TUint connEnum(0);
  1949         TUint connEnum(0);
  1913 	        TInt err = iConnection.EnumerateConnections(connEnum);
  1950         TInt err = iConnection.EnumerateConnections(connEnum);
  1914 	        if (!err && !connEnum)
  1951         TLSLOG_FORMAT((KSenHttpChannelLogChannelBase , KMinLogLevel, _L8("CSenHttpChannelImpl::EffectiveIapId -  EnumerateConnections retVal [%d]"), err ));
  1915 	            {
  1952         if (!err && !connEnum)
  1916 	            return EFalse;
  1953             {
  1917 	            }
  1954             TLSLOG_L(KSenHttpChannelLogChannelBase , KMinLogLevel,"CSenHttpChannelImpl::EffectiveIapId returns");
       
  1955             return EFalse;
       
  1956             }
  1918 		    }
  1957 		    }
  1919 	    else
  1958 	    else
  1920 		    {
  1959 		    {
  1921 		    TLSLOG_L(KSenHttpChannelLogChannelBase , KMinLogLevel," -> RConnection has not been initialized.");	
  1960 		    TLSLOG_L(KSenHttpChannelLogChannelBase , KMinLogLevel," -> RConnection has not been initialized.");	
  1922 		    }
  1961 		    }
  1923 
  1962 		*/
  1924 	if( iExplicitIapDefined )
  1963 	if( iExplicitIapDefined )
  1925 		{
  1964 		{
  1926 		TLSLOG_FORMAT((KSenHttpChannelLogChannelBase , KMinLogLevel, _L8(" - IAP ID is known: %d"), iIapId ));
  1965 		TLSLOG_FORMAT((KSenHttpChannelLogChannelBase , KMinLogLevel, _L8(" - IAP ID is known: %d"), iIapId ));
  1927 		}
  1966 		}
  1928 	else
  1967 	else
  1929 		{
  1968 		{
  1930 		TLSLOG_L(KSenHttpChannelLogChannelBase , KMinLogLevel," - IAP ID is not known.");
  1969 		TLSLOG_L(KSenHttpChannelLogChannelBase , KMinLogLevel," - IAP ID is not known.");
  1931 		}
  1970 		}
  1932 		    
  1971 		    
  1933     if( handle && !iExplicitIapDefined )
  1972   if(/* handle && */!iExplicitIapDefined )
  1934     	{
  1973   	{
  1935 		// Eventhough IAP was not explicitely set (through Serene API), this
  1974 		// Eventhough IAP was not explicitely set (through Serene API), this
  1936 		// code can check what IAP end-user provided via IAP selection dialog:
  1975 		// code can check what IAP end-user provided via IAP selection dialog:
  1937 		TLSLOG_L(KSenHttpChannelLogChannelBase , KMinLogLevel,"CSenHttpChannelImpl::EffectiveIapId: about to call RConnection::GetIntSetting()");
  1976 		TLSLOG_L(KSenHttpChannelLogChannelBase , KMinLogLevel,"CSenHttpChannelImpl::EffectiveIapId: about to call RConnection::GetIntSetting()");
  1938 		_LIT( KIapIdKey, "IAP\\Id" );
  1977 	//_LIT( KIapIdKey, "IAP\\Id" );
  1939 	    iConnection.GetIntSetting( KIapIdKey, iIapId);
  1978     //iConnection.GetIntSetting( KIapIdKey, iIapId);
  1940 	    if ( iIapId > 0 )
  1979     if ( iIapId > 0 )
  1941 	    	{
  1980     	{
  1942 			TLSLOG_FORMAT((KSenHttpChannelLogChannelBase , KMinLogLevel, _L8("---- GetIntSetting(): retuens IAP(%d)"), iIapId ));
  1981 			TLSLOG_FORMAT((KSenHttpChannelLogChannelBase , KMinLogLevel, _L8("---- GetIntSetting(): retuens IAP(%d)"), iIapId ));
  1943 	    	// Treat the end-user selection as "explicit" definition as well(!):
  1982     	// Treat the end-user selection as "explicit" definition as well(!):
  1944 	    	iExplicitIapDefined = ETrue; 
  1983     	iExplicitIapDefined = ETrue; 
  1945 	    	}
  1984     	}
  1946 	    }
  1985     }
  1947     if( iExplicitIapDefined )
  1986   if( iExplicitIapDefined )
  1948         {
  1987       {
  1949         aIapId = iIapId;
  1988       aIapId = iIapId;
  1950         }
  1989       }
       
  1990   	TLSLOG_FORMAT((KSenHttpChannelLogChannelBase , KMinLogLevel, _L8("CSenHttpChannelImpl::EffectiveIapId() returns(%d)"), iExplicitIapDefined ));
  1951     return iExplicitIapDefined;
  1991     return iExplicitIapDefined;
  1952     }
  1992     }
  1953 
  1993 
  1954 void CSenHttpChannelImpl::EnableTimeOutL(TInt aTxnId, TInt aTimeOutSec)
  1994 void CSenHttpChannelImpl::EnableTimeOutL(TInt aTxnId, TInt aTimeOutSec)
  1955     {
  1995     {
  1966 
  2006 
  1967 TInt32 CSenHttpChannelImpl::UsedIap()
  2007 TInt32 CSenHttpChannelImpl::UsedIap()
  1968     {
  2008     {
  1969     return iUsedIapId;
  2009     return iUsedIapId;
  1970     }
  2010     }
       
  2011     
       
  2012 void CSenHttpChannelImpl::ResetIapId()
       
  2013     {
       
  2014     TLSLOG_L(KSenHttpChannelLogChannelBase , KMinLogLevel,"CSenHttpChannelImpl::ResetIapId()");
       
  2015     iIapId = 0; //Reset to Zero in case of errors to enable other IAP
       
  2016     }
       
  2017 		
       
  2018 void CSenHttpChannelImpl::ResetUsedIapId()
       
  2019     {
       
  2020     TLSLOG_L(KSenHttpChannelLogChannelBase , KMinLogLevel,"CSenHttpChannelImpl::ResetUsedIapId()");
       
  2021     iUsedIapId = 0; //Reset to Zero in case of errors to enable other IAP
       
  2022     }
       
  2023     
  1971 // END OF FILE
  2024 // END OF FILE