webservices/wshttpchanneltransportplugin/src/senhttpchannelimpl.cpp
branchRCL_3
changeset 24 d9641c85af2b
parent 23 1adb97a15c2f
equal deleted inserted replaced
23:1adb97a15c2f 24:d9641c85af2b
    72 // Implementation of CSenHttpChannelImpl
    72 // Implementation of CSenHttpChannelImpl
    73 //
    73 //
    74 CSenHttpChannelImpl::CSenHttpChannelImpl(MSenIdentityManager& aManager)
    74 CSenHttpChannelImpl::CSenHttpChannelImpl(MSenIdentityManager& aManager)
    75 :
    75 :
    76     iIapId(KErrNone),
    76     iIapId(KErrNone),
       
    77     iUsedIapId(KErrNone),
       
    78     iSnapId(KErrNone),
    77     iManager(aManager),
    79     iManager(aManager),
    78     iSessionAuthentication(NULL),
    80     iSessionAuthentication(NULL),
    79     iPasswordFromUser(EFalse),
    81     iPasswordFromUser(EFalse),
    80     iExplicitIapDefined(EFalse),
    82     iExplicitIapDefined(EFalse),
    81     iProxyHostPort(NULL),
    83     iProxyHostPort(NULL),
   742         TLSLOG_FORMAT((KSenHttpChannelLogChannelBase , KMinLogLevel, _L8("CSenHttpChannelImpl::InvokeHttpMethodL SetIapPrefs - iIapId [%d]"), iIapId)); 
   744         TLSLOG_FORMAT((KSenHttpChannelLogChannelBase , KMinLogLevel, _L8("CSenHttpChannelImpl::InvokeHttpMethodL SetIapPrefs - iIapId [%d]"), iIapId)); 
   743         retVal = SetIapPrefsL(iIapId, prompt, iConnection, iSockServ);
   745         retVal = SetIapPrefsL(iIapId, prompt, iConnection, iSockServ);
   744         }
   746         }
   745     else if(((aProps.SnapIdL(id)) == KErrNone))
   747     else if(((aProps.SnapIdL(id)) == KErrNone))
   746         {
   748         {
       
   749         TLSLOG_FORMAT((KSenHttpChannelLogChannelBase , KMinLogLevel, _L8("CSenHttpChannelImpl::InvokeHttpMethodL SetSnapPrefsL - Snap Id [%d]"), id));
   747         retVal = SetSnapPrefsL(id, prompt, iConnection, iSockServ);
   750         retVal = SetSnapPrefsL(id, prompt, iConnection, iSockServ);
   748         }
   751         }
   749     else//to better control RConnection, we have to call Start by ourselve
   752     else//to better control RConnection, we have to call Start by ourselve
   750         {
   753         {
       
   754         TLSLOG_L(KSenHttpChannelLogChannelBase , KMinLogLevel,"CSenHttpChannelImpl::InvokeHttpMethodL - No Snap Id and No Iap Id");
   751         retVal = SetSnapPrefsL(0, EFalse, iConnection, iSockServ);
   755         retVal = SetSnapPrefsL(0, EFalse, iConnection, iSockServ);
   752         if(retVal == KErrNotFound)
   756         if(retVal == KErrNotFound)
   753             {
   757             {
   754             if(iOCCenabled == EFalse)
   758             if(iOCCenabled == EFalse)
   755 		        {
   759 		        {
       
   760 		        TLSLOG_L(KSenHttpChannelLogChannelBase , KMinLogLevel,"CSenHttpChannelImpl::InvokeHttpMethodL - iOCCenabled EFalse calling SetIapPrefsL");
   756 	    	    retVal = SetIapPrefsL(0, EFalse, iConnection, iSockServ);	
   761 	    	    retVal = SetIapPrefsL(0, EFalse, iConnection, iSockServ);	
   757 	        	}
   762 	        	}
   758         	else
   763         	else
   759 	        	{
   764 	        	{
       
   765 	        	TLSLOG_L(KSenHttpChannelLogChannelBase , KMinLogLevel,"CSenHttpChannelImpl::InvokeHttpMethodL - iOCCenabled ETrue calling SetSnapPrefsL");
   760 	        	retVal = SetSnapPrefsL(0, prompt, iConnection, iSockServ);	
   766 	        	retVal = SetSnapPrefsL(0, prompt, iConnection, iSockServ);	
   761 	        	}
   767 	        	}
   762             }
   768             }
   763         }
   769         }
   764     TLSLOG_FORMAT((KSenHttpChannelLogChannelBase , KMinLogLevel, _L8("Set Snap/IAP prefs retVal [%d]"), retVal));    
   770     TLSLOG_FORMAT((KSenHttpChannelLogChannelBase , KMinLogLevel, _L8("Set Snap/IAP prefs retVal [%d]"), retVal));    
  1286                     retVal));
  1292                     retVal));
  1287                 iSessionAuthentication = NULL;
  1293                 iSessionAuthentication = NULL;
  1288                 TLSLOG_L(KSenHttpChannelLogChannelBase , KMinLogLevel,"GetCredentialsL() returning EFalse");
  1294                 TLSLOG_L(KSenHttpChannelLogChannelBase , KMinLogLevel,"GetCredentialsL() returning EFalse");
  1289                 return EFalse; // decision: we could not save info into database, abort
  1295                 return EFalse; // decision: we could not save info into database, abort
  1290                 }
  1296                 }
  1291             TLSLOG_L(KSenHttpChannelLogChannelBase , KMinLogLevel,"--- New IDP registeration OK. Proceeding.");
  1297             TLSLOG_L(KSenHttpChannelLogChannelBase , KMinLogLevel,"New IDP registeration OK. Proceeding.");
  1292             }
  1298             }
  1293         // we have credentials
  1299         // we have credentials
  1294        TLSLOG_L(KSenHttpChannelLogChannelBase , KMinLogLevel,"--- we have credentials");         
  1300        TLSLOG_L(KSenHttpChannelLogChannelBase , KMinLogLevel,"--- we have credentials");         
  1295         TRAPD(err, aUsername = 
  1301         TRAPD(err, aUsername = 
  1296             aRealm.Pool().OpenStringL(iSessionAuthentication->AuthzID()));
  1302             aRealm.Pool().OpenStringL(iSessionAuthentication->AuthzID()));
  1297         TRAP(err, aPassword = 
  1303         TRAP(err, aPassword = 
  1298             aRealm.Pool().OpenStringL(iSessionAuthentication->Password()));
  1304             aRealm.Pool().OpenStringL(iSessionAuthentication->Password()));
  1299 		TLSLOG_FORMAT((KSenHttpChannelLogChannelBase , KMinLogLevel, _L8("--- username (%s), password (%d)"), aUsername, aPassword));
  1305 				TLSLOG_FORMAT((KSenHttpChannelLogChannelBase , KMinLogLevel, _L8("--- username (%S), password (%S)"), &aUsername.DesC(), &aPassword.DesC()));
  1300         TLSLOG_L(KSenHttpChannelLogChannelBase , KMinLogLevel,"GetCredentialsL() returning ETrue");
  1306         TLSLOG_L(KSenHttpChannelLogChannelBase , KMinLogLevel,"GetCredentialsL() returning ETrue");
  1301         return ETrue;
  1307         return ETrue;
  1302         }
  1308         }
  1303     else
  1309     else
  1304         {
  1310         {
  1407                       }
  1413                       }
  1408                   }
  1414                   }
  1409               ++fields;
  1415               ++fields;
  1410              }
  1416              }
  1411         CleanupStack::Pop(tp);
  1417         CleanupStack::Pop(tp);
       
  1418         TLSLOG(KSenHttpChannelLogChannelBase , KMinLogLevel,(_L("CSenHttpChannelImpl::HandleResponseHeadersL() returns")));
  1412         return;
  1419         return;
  1413         }
  1420         }
  1414         
  1421         
  1415     else if (status == 200)
  1422     else if (status == 200)
  1416         {
  1423         {
  1439                     fieldValPtr.Set(iStringPool.String(fieldVal.Str()).DesC());
  1446                     fieldValPtr.Set(iStringPool.String(fieldVal.Str()).DesC());
  1440                     }
  1447                     }
  1441                 break;
  1448                 break;
  1442                 default:
  1449                 default:
  1443                     {
  1450                     {
       
  1451                     TLSLOG(KSenHttpChannelLogChannelBase , KMinLogLevel,(_L("CSenHttpChannelImpl::HandleResponseHeadersL() User::Panic")));
  1444                     User::Panic(KUnrecognisedValueTypeOfContentTypePanicText,
  1452                     User::Panic(KUnrecognisedValueTypeOfContentTypePanicText,
  1445                                 EContentTypeUnrecognisedValueType);
  1453                                 EContentTypeUnrecognisedValueType);
  1446                     }
  1454                     }
  1447                 }
  1455                 }
  1448             _LIT8(KMultipartRelated,"Multipart/Related");	//CodeScannerWarning
  1456             _LIT8(KMultipartRelated,"Multipart/Related");	//CodeScannerWarning
  1483                                     }
  1491                                     }
  1484                                 if (iMultiPartContentType.params[i].paramValue == KApplication)   
  1492                                 if (iMultiPartContentType.params[i].paramValue == KApplication)   
  1485                                     {
  1493                                     {
  1486                                     iXopResponse = ETrue;
  1494                                     iXopResponse = ETrue;
  1487                                     content.Close();
  1495                                     content.Close();
       
  1496                                     TLSLOG(KSenHttpChannelLogChannelBase , KMinLogLevel,(_L("CSenHttpChannelImpl::HandleResponseHeadersL() returns")));
  1488                                     return;
  1497                                     return;
  1489                                     }
  1498                                     }
  1490                                 }
  1499                                 }
  1491                             }
  1500                             }
  1492                         }
  1501                         }
  1494                 }
  1503                 }
  1495            else 
  1504            else 
  1496                 {
  1505                 {
  1497                 iContentType.Set(fieldValPtr);
  1506                 iContentType.Set(fieldValPtr);
  1498                 content.Close();
  1507                 content.Close();
       
  1508                 TLSLOG(KSenHttpChannelLogChannelBase , KMinLogLevel,(_L("CSenHttpChannelImpl::HandleResponseHeadersL() returns")));
  1499                 return;
  1509                 return;
  1500                 }
  1510                 }
  1501             }
  1511             }
  1502         iHasHttpContentType = EFalse;
  1512         iHasHttpContentType = EFalse;
  1503         content.Close();
  1513         content.Close();
  1504         }
  1514         }
       
  1515     TLSLOG(KSenHttpChannelLogChannelBase , KMinLogLevel,(_L("CSenHttpChannelImpl::HandleResponseHeadersL() Completed")));
  1505     }
  1516     }
  1506 
  1517 
  1507 TInt CSenHttpChannelImpl::ContentTypeParamValueL(const RHTTPHeaders& aResponseHeaders,
  1518 TInt CSenHttpChannelImpl::ContentTypeParamValueL(const RHTTPHeaders& aResponseHeaders,
  1508                                 const RStringF& aContent, 
  1519                                 const RStringF& aContent, 
  1509                                 const TPtrC8& aParamName,
  1520                                 const TPtrC8& aParamName,
  1589         //pTxnState->ResponseError(-20000);
  1600         //pTxnState->ResponseError(-20000);
  1590         pTxnState->ResponseErrorL(KErrSenNoHttpResponseBody); //SenServiceConnection.h // was -20000
  1601         pTxnState->ResponseErrorL(KErrSenNoHttpResponseBody); //SenServiceConnection.h // was -20000
  1591         DeleteTxnState(txnId);
  1602         DeleteTxnState(txnId);
  1592         aTransaction.Close();
  1603         aTransaction.Close();
  1593         }
  1604         }
       
  1605     TLSLOG(KSenHttpChannelLogChannelBase , KMinLogLevel,(_L("CSenHttpChannelImpl::HandleResponseBodyDataL() Completed")));   
  1594     }
  1606     }
  1595 
  1607 
  1596 void CSenHttpChannelImpl::HandleResponseL(RHTTPTransaction aTransaction)
  1608 void CSenHttpChannelImpl::HandleResponseL(RHTTPTransaction aTransaction)
  1597     {
  1609     {
  1598     TInt txnId = aTransaction.Id();
  1610     TInt txnId = aTransaction.Id();
  1623         pTxnState->ResponseErrorL(KErrSenNoHttpContentType); // was: -20001
  1635         pTxnState->ResponseErrorL(KErrSenNoHttpContentType); // was: -20001
  1624         }
  1636         }
  1625 
  1637 
  1626     DeleteTxnState(txnId);
  1638     DeleteTxnState(txnId);
  1627     aTransaction.Close();
  1639     aTransaction.Close();
       
  1640     TLSLOG(KSenHttpChannelLogChannelBase , KMinLogLevel,(_L("CSenHttpChannelImpl::HandleResponseL() Completed")));
  1628     }
  1641     }
  1629 
  1642 
  1630 void CSenHttpChannelImpl::HandleRunErrorL(RHTTPTransaction aTransaction,
  1643 void CSenHttpChannelImpl::HandleRunErrorL(RHTTPTransaction aTransaction,
  1631                                           TInt aError)
  1644                                           TInt aError)
  1632     {
  1645     {
  1633     TLSLOG_L(KSenHttpChannelLogChannelBase , KMaxLogLevel,"CSenHttpChannelImpl::HandleRunErrorL()");
  1646     TLSLOG_L(KSenHttpChannelLogChannelBase , KMinLogLevel,"CSenHttpChannelImpl::HandleRunErrorL()");
  1634     TInt txnId = aTransaction.Id();
  1647     TInt txnId = aTransaction.Id();
  1635     TLSLOG_FORMAT((KSenHttpChannelLogChannelBase , KMinLogLevel, _L8("CSenHttpChannelImpl::HandleRunErrorL( %d ): %d"),txnId, aError));
  1648     TLSLOG_FORMAT((KSenHttpChannelLogChannelBase , KMinLogLevel, _L8("CSenHttpChannelImpl::HandleRunErrorL( )- Txn Id [%d], Error Id [%d]"),txnId, aError));
  1636     CSenTxnState* pTxnState = FindTxnState(txnId);
  1649     CSenTxnState* pTxnState = FindTxnState(txnId);
  1637     __ASSERT_ALWAYS(pTxnState != NULL,
  1650     __ASSERT_ALWAYS(pTxnState != NULL,
  1638                     User::Panic(KTxnStateNullPanicText,
  1651                     User::Panic(KTxnStateNullPanicText,
  1639                     CSenHttpChannel::ETxnStateNull));
  1652                     CSenHttpChannel::ETxnStateNull));
  1640 
  1653 
  1641     pTxnState->ResponseErrorL(aError);
  1654     pTxnState->ResponseErrorL(aError);
  1642     DeleteTxnState(txnId);
  1655     DeleteTxnState(txnId);
  1643     aTransaction.Close();
  1656     aTransaction.Close();
  1644     TLSLOG_L(KSenHttpChannelLogChannelBase , KMaxLogLevel,"CSenHttpChannelImpl::HandleRunErrorL() Completed");
  1657     TLSLOG_L(KSenHttpChannelLogChannelBase , KMinLogLevel,"CSenHttpChannelImpl::HandleRunErrorL() Completed");
  1645     }
  1658     }
  1646 
  1659 
  1647 void CSenHttpChannelImpl::HandleRedirectRequiresConfirmationL(
  1660 void CSenHttpChannelImpl::HandleRedirectRequiresConfirmationL(
  1648                                                 RHTTPTransaction aTransaction)
  1661                                                 RHTTPTransaction aTransaction)
  1649     {
  1662     {
  1655                     User::Panic(KTxnStateNullPanicText,
  1668                     User::Panic(KTxnStateNullPanicText,
  1656                     CSenHttpChannel::ETxnStateNull));
  1669                     CSenHttpChannel::ETxnStateNull));
  1657     pTxnState->ResponseErrorL(KErrSenHttpRedirectRequiresConfirmation); // was: -20002
  1670     pTxnState->ResponseErrorL(KErrSenHttpRedirectRequiresConfirmation); // was: -20002
  1658     DeleteTxnState(txnId);
  1671     DeleteTxnState(txnId);
  1659     aTransaction.Close();
  1672     aTransaction.Close();
       
  1673     TLSLOG_L(KSenHttpChannelLogChannelBase , KMinLogLevel,"CSenHttpChannelImpl::HandleRedirectRequiresConfirmationL() Completed");
  1660     }
  1674     }
  1661 /*
  1675 /*
  1662 RFileLogger* CSenHttpChannelImpl::Log() const
  1676 RFileLogger* CSenHttpChannelImpl::Log() const
  1663     {
  1677     {
  1664     return (RFileLogger*) &iLog;
  1678     return (RFileLogger*) &iLog;