wmdrm/camese/wmdrmdladefaulthttpplugin/src/wmdrmdladefaulthttpmanager.cpp
changeset 1 c562c0bc23e5
parent 0 95b198f216e5
child 14 8cdda00a45da
equal deleted inserted replaced
0:95b198f216e5 1:c562c0bc23e5
     1 /*
     1 /*
     2 * Copyright (c) 2008 Nokia Corporation and/or its subsidiary(-ies).
     2 * Copyright (c) 2008-2009 Nokia Corporation and/or its subsidiary(-ies).
     3 * All rights reserved.
     3 * All rights reserved.
     4 * This component and the accompanying materials are made available
     4 * This component and the accompanying materials are made available
     5 * under the terms of "Eclipse Public License v1.0"
     5 * under the terms of "Eclipse Public License v1.0"
     6 * which accompanies this distribution, and is available
     6 * which accompanies this distribution, and is available
     7 * at the URL "http://www.eclipse.org/legal/epl-v10.html".
     7 * at the URL "http://www.eclipse.org/legal/epl-v10.html".
    25 #define _LOGGING_FILE L"wmdrmdladefaulthttpplugin.txt"
    25 #define _LOGGING_FILE L"wmdrmdladefaulthttpplugin.txt"
    26 #include "logfn.h"
    26 #include "logfn.h"
    27 
    27 
    28 /**
    28 /**
    29  *  HTTP_STRING macro
    29  *  HTTP_STRING macro
    30  *  To use HTTP_STRING macro you need a variable 'pool' defined (of 
    30  *  To use HTTP_STRING macro you need a variable 'pool' defined (of
    31  *  RStringPool type).
    31  *  RStringPool type).
    32  *  @param  aStringId  - an ID for string from HTTP Client's string table 
    32  *  @param  aStringId  - an ID for string from HTTP Client's string table
    33  *  (e.g. 'HTTP::EAccept')
    33  *  (e.g. 'HTTP::EAccept')
    34  */
    34  */
    35 #define HTTP_STRING(aStringId)pool.StringF(aStringId, RHTTPSession::GetTable())
    35 #define HTTP_STRING(aStringId)pool.StringF(aStringId, RHTTPSession::GetTable())
    36 
    36 
    37 /**
    37 /**
    49 // ================= MEMBER FUNCTIONS =======================
    49 // ================= MEMBER FUNCTIONS =======================
    50 
    50 
    51 // ----------------------------------------------------------------------------
    51 // ----------------------------------------------------------------------------
    52 // CWmDrmDlaDefaultHttpManager::NewL
    52 // CWmDrmDlaDefaultHttpManager::NewL
    53 // ----------------------------------------------------------------------------
    53 // ----------------------------------------------------------------------------
    54 CWmDrmDlaDefaultHttpManager* CWmDrmDlaDefaultHttpManager::NewL( 
    54 CWmDrmDlaDefaultHttpManager* CWmDrmDlaDefaultHttpManager::NewL(
    55     MWmDrmDlaDefaltHttpManagerObserver& aObserver )
    55     MWmDrmDlaDefaltHttpManagerObserver& aObserver )
    56     {
    56     {
    57     LOGFN( "CWmDrmDlaDefaultHttpManager::NewL(1)" );
    57     LOGFN( "CWmDrmDlaDefaultHttpManager::NewL(1)" );
    58     CWmDrmDlaDefaultHttpManager* self = 
    58     CWmDrmDlaDefaultHttpManager* self =
    59         new(ELeave) CWmDrmDlaDefaultHttpManager( aObserver, 0 );
    59         new(ELeave) CWmDrmDlaDefaultHttpManager( aObserver, 0 );
    60     CleanupStack::PushL( self );
    60     CleanupStack::PushL( self );
    61     self->ConstructL();
    61     self->ConstructL();
    62     CleanupStack::Pop( self );
    62     CleanupStack::Pop( self );
    63     return self;
    63     return self;
    64     }
    64     }
    65 
    65 
    66 // ----------------------------------------------------------------------------
    66 // ----------------------------------------------------------------------------
    67 // CWmDrmDlaDefaultHttpManager::NewL
    67 // CWmDrmDlaDefaultHttpManager::NewL
    68 // ----------------------------------------------------------------------------
    68 // ----------------------------------------------------------------------------
    69 CWmDrmDlaDefaultHttpManager* CWmDrmDlaDefaultHttpManager::NewL( 
    69 CWmDrmDlaDefaultHttpManager* CWmDrmDlaDefaultHttpManager::NewL(
    70     MWmDrmDlaDefaltHttpManagerObserver& aObserver,
    70     MWmDrmDlaDefaltHttpManagerObserver& aObserver,
    71     TUint32 aIapNumber )
    71     TUint32 aIapNumber )
    72     {
    72     {
    73     LOGFN( "CWmDrmDlaDefaultHttpManager::NewL(2)" );
    73     LOGFN( "CWmDrmDlaDefaultHttpManager::NewL(2)" );
    74     CWmDrmDlaDefaultHttpManager* self = 
    74     CWmDrmDlaDefaultHttpManager* self =
    75         new(ELeave) CWmDrmDlaDefaultHttpManager( aObserver, aIapNumber );
    75         new(ELeave) CWmDrmDlaDefaultHttpManager( aObserver, aIapNumber );
    76     CleanupStack::PushL( self );
    76     CleanupStack::PushL( self );
    77     self->ConstructL();
    77     self->ConstructL();
    78     CleanupStack::Pop( self );
    78     CleanupStack::Pop( self );
    79     return self;
    79     return self;
   199 // CWmDrmDlaDefaultHttpManager::GetConnectionInfoL
   199 // CWmDrmDlaDefaultHttpManager::GetConnectionInfoL
   200 // Note: TConnectionInfo& aConnectionInfo creates a PC-Lint warning to make it
   200 // Note: TConnectionInfo& aConnectionInfo creates a PC-Lint warning to make it
   201 // const but aConnectionInfo is being changed after it has been put into a
   201 // const but aConnectionInfo is being changed after it has been put into a
   202 // package and GetConnectionInfo is called on the connection
   202 // package and GetConnectionInfo is called on the connection
   203 // ----------------------------------------------------------------------------
   203 // ----------------------------------------------------------------------------
   204 void CWmDrmDlaDefaultHttpManager::GetConnectionInfoL( 
   204 void CWmDrmDlaDefaultHttpManager::GetConnectionInfoL(
   205     TConnectionInfo& aConnectionInfo )
   205     TConnectionInfo& aConnectionInfo )
   206     {
   206     {
   207     LOGFN( "CWmDrmDlaDefaultHttpManager::GetConnectionInfoL" );
   207     LOGFN( "CWmDrmDlaDefaultHttpManager::GetConnectionInfoL" );
   208     if ( (iState != EOpen) && (iState != ESubmit) )
   208     if ( (iState != EOpen) && (iState != ESubmit) )
   209         {
   209         {
   242 // ============================== PRIVATE METHODS ==============================
   242 // ============================== PRIVATE METHODS ==============================
   243 
   243 
   244 // ----------------------------------------------------------------------------
   244 // ----------------------------------------------------------------------------
   245 // CWmDrmDlaDefaultHttpManager::MHFRunL
   245 // CWmDrmDlaDefaultHttpManager::MHFRunL
   246 // ----------------------------------------------------------------------------
   246 // ----------------------------------------------------------------------------
   247 void CWmDrmDlaDefaultHttpManager::MHFRunL( 
   247 void CWmDrmDlaDefaultHttpManager::MHFRunL(
   248     RHTTPTransaction aTransaction, 
   248     RHTTPTransaction aTransaction,
   249     const THTTPEvent& aEvent )
   249     const THTTPEvent& aEvent )
   250     {
   250     {
   251     LOGFN( "CWmDrmDlaDefaultHttpManager::MHFRunL" );
   251     LOGFN( "CWmDrmDlaDefaultHttpManager::MHFRunL" );
   252     RHTTPResponse response;
   252     RHTTPResponse response;
   253     TPtrC8 dataChunk;
   253     TPtrC8 dataChunk;
   254     
   254 
   255     // Either ESucceeded or EFailed will eventually occur
   255     // Either ESucceeded or EFailed will eventually occur
   256     switch ( aEvent.iStatus )
   256     switch ( aEvent.iStatus )
   257         {
   257         {
   258         case THTTPEvent::EGotResponseHeaders:
   258         case THTTPEvent::EGotResponseHeaders:
   259             response = aTransaction.Response();
   259             response = aTransaction.Response();
   260     
   260 
   261             iInCallback = ETrue;
   261             iInCallback = ETrue;
   262             iObserver.OnResponseHeadersL(
   262             iObserver.OnResponseHeadersL(
   263                 response,
   263                 response,
   264                 response.GetHeaderCollection(),
   264                 response.GetHeaderCollection(),
   265                 iHttpSession.StringPool(),
   265                 iHttpSession.StringPool(),
   266                 response.StatusCode() );
   266                 response.StatusCode() );
   267     
   267 
   268             break;
   268             break;
   269     
   269 
   270         case THTTPEvent::EGotResponseBodyData:
   270         case THTTPEvent::EGotResponseBodyData:
   271             // A member variable is used to store the body to avoid two 
   271             // A member variable is used to store the body to avoid two
   272             // potential problems:
   272             // potential problems:
   273             // - OnResponseBodyDataL leaves
   273             // - OnResponseBodyDataL leaves
   274             // - Stop is called from within OnResponseBodyDataL
   274             // - Stop is called from within OnResponseBodyDataL
   275             iBody = aTransaction.Response().Body();
   275             iBody = aTransaction.Response().Body();
   276             User::LeaveIfNull( iBody );
   276             User::LeaveIfNull( iBody );
   277     
   277 
   278             iBody->GetNextDataPart( dataChunk );
   278             iBody->GetNextDataPart( dataChunk );
   279     
   279 
   280             iInCallback = ETrue;
   280             iInCallback = ETrue;
   281             iObserver.OnResponseBodyDataL( dataChunk );
   281             iObserver.OnResponseBodyDataL( dataChunk );
   282     
   282 
   283             // Verify that iBody wasn't already released
   283             // Verify that iBody wasn't already released
   284             // for example by calling Stop within ResponseBodyDataL
   284             // for example by calling Stop within ResponseBodyDataL
   285             if ( iBody )
   285             if ( iBody )
   286                 {
   286                 {
   287                 iBody->ReleaseData();
   287                 iBody->ReleaseData();
   288                 iBody = NULL;
   288                 iBody = NULL;
   289                 }
   289                 }
   290                 
   290 
   291             break;
   291             break;
   292     
   292 
   293         case THTTPEvent::ESucceeded:
   293         case THTTPEvent::ESucceeded:
   294         case THTTPEvent::EFailed:
   294         case THTTPEvent::EFailed:
   295             // Deal with both the same as iError will either be negative or 
   295             // Deal with both the same as iError will either be negative or
   296             // KErrNone
   296             // KErrNone
   297             // If the user cancelled the credentials dialog then make sure we 
   297             // If the user cancelled the credentials dialog then make sure we
   298             // return KErrCancel
   298             // return KErrCancel
   299             HandleDownloadComplete( iCredentialsOk ? iError : KErrCancel );
   299             HandleDownloadComplete( iCredentialsOk ? iError : KErrCancel );
   300             break;
   300             break;
   301     
   301 
   302         default:
   302         default:
   303             // This will capture system and HTTP lib errors
   303             // This will capture system and HTTP lib errors
   304             // For positive codes iError will remain to KErrNone
   304             // For positive codes iError will remain to KErrNone
   305             if ( aEvent.iStatus < KErrNone )
   305             if ( aEvent.iStatus < KErrNone )
   306                 {
   306                 {
   344         {
   344         {
   345         DeleteUsernamePassword();
   345         DeleteUsernamePassword();
   346 
   346 
   347         // Get the username/password
   347         // Get the username/password
   348         iInCallback = ETrue;
   348         iInCallback = ETrue;
   349         iCredentialsOk = 
   349         iCredentialsOk =
   350             iObserver.OnGetUsernamePasswordL( iUsername, iPassword );
   350             iObserver.OnGetUsernamePasswordL( iUsername, iPassword );
   351         iInCallback = EFalse;
   351         iInCallback = EFalse;
   352 
   352 
   353         // authentication = iCredentialsOk && iUsername && iPassword
   353         // authentication = iCredentialsOk && iUsername && iPassword
   354         // no authentication = !iCredentialsOk && !iUsername && !iPassword
   354         // no authentication = !iCredentialsOk && !iUsername && !iPassword
   355         ASSERT( (iCredentialsOk && iUsername && iPassword) || 
   355         ASSERT( (iCredentialsOk && iUsername && iPassword) ||
   356             (!iCredentialsOk && !iUsername && !iPassword ) );
   356             (!iCredentialsOk && !iUsername && !iPassword ) );
   357 
   357 
   358         if (iCredentialsOk)
   358         if (iCredentialsOk)
   359             {
   359             {
   360             aUsername = pool.OpenStringL( *iUsername );
   360             aUsername = pool.OpenStringL( *iUsername );
   371 // Overrides CActive::RunL
   371 // Overrides CActive::RunL
   372 // ----------------------------------------------------------------------------
   372 // ----------------------------------------------------------------------------
   373 void CWmDrmDlaDefaultHttpManager::RunL()
   373 void CWmDrmDlaDefaultHttpManager::RunL()
   374     {
   374     {
   375     LOGFN( "CWmDrmDlaDefaultHttpManager::RunL" );
   375     LOGFN( "CWmDrmDlaDefaultHttpManager::RunL" );
   376     User::LeaveIfError( iStatus.Int() );
   376     TInt error( iStatus.Int() );
       
   377     LOG3( "CWmDrmDlaDefaultHttpManager State: %d Status: %d", iState, error );
       
   378 
       
   379     if ( iState == EOpen && error == KErrNotFound )
       
   380         {
       
   381         iState=EOpenFailed;
       
   382         }
       
   383     else
       
   384         {
       
   385         User::LeaveIfError( error );
       
   386         }
   377 
   387 
   378     switch (iState)
   388     switch (iState)
   379         {
   389         {
   380         case EStart:
   390         case EStart:
   381             InitializeL();
   391             InitializeL();
   382             break;
   392             break;
   383         case EInitialize:
   393         case EInitialize:
   384             Open();
   394             OpenL();
   385             break;
   395             break;
       
   396         case EOpenFailed: // Called only if open fails
       
   397             ReconnectL();
       
   398             break;
       
   399         case EReconnect:
       
   400             iState=EOpen;
       
   401             // Note: intentionally no break
       
   402             // Successfully completed EReconnect is same as EOpen.
   386         case EOpen:
   403         case EOpen:
   387             SubmitL();
   404             SubmitL();
   388             break;
   405             break;
   389         default:
   406         default:
   390             // Panic if called while in ESubmit
   407             // Panic if called while in ESubmit
   391             ASSERT( 0 );
   408             ASSERT( 0 );
   392             break;
   409             break;
   393         }
   410         }
   394 
   411 
   395     // Do not advance the state if the transaction was submitted
   412     // Do not advance the state if the transaction was submitted
   396     // MHFRunL will be called by the HTTP stack while the transaction 
   413     // MHFRunL will be called by the HTTP stack while the transaction
   397     // progresses
   414     // progresses
   398     if ( iState != ESubmit )
   415     if ( iState != ESubmit )
   399         {
   416         {
   400         // Go to the next state if not finished
   417         // Go to the next state if not finished
   401         CompleteSelf();
   418         CompleteSelf();
   426 // Overrides CActive::RunError
   443 // Overrides CActive::RunError
   427 // ----------------------------------------------------------------------------
   444 // ----------------------------------------------------------------------------
   428 TInt CWmDrmDlaDefaultHttpManager::RunError( TInt aError )
   445 TInt CWmDrmDlaDefaultHttpManager::RunError( TInt aError )
   429     {
   446     {
   430     LOGFN( "CWmDrmDlaDefaultHttpManager::RunError" );
   447     LOGFN( "CWmDrmDlaDefaultHttpManager::RunError" );
   431     LOG2( "aError: %d", aError ); 
   448     LOG2( "aError: %d", aError );
   432     // Cleanup and generate the callback
   449     // Cleanup and generate the callback
   433     HandleDownloadComplete( aError );
   450     HandleDownloadComplete( aError );
   434     return KErrNone;
   451     return KErrNone;
   435     }
   452     }
   436 
   453 
   470     iState = EInitialize;
   487     iState = EInitialize;
   471     }
   488     }
   472 
   489 
   473 // ----------------------------------------------------------------------------
   490 // ----------------------------------------------------------------------------
   474 // CWmDrmDlaDefaultHttpManager::OpenL
   491 // CWmDrmDlaDefaultHttpManager::OpenL
   475 // Handler for the EInitialize state. 
   492 // Handler for the EInitialize state.
   476 // ----------------------------------------------------------------------------
   493 // ----------------------------------------------------------------------------
   477 void CWmDrmDlaDefaultHttpManager::Open()
   494 void CWmDrmDlaDefaultHttpManager::OpenL()
   478     {
   495     {
   479     LOGFN( "CWmDrmDlaDefaultHttpManager::Open" );
   496     LOGFN( "CWmDrmDlaDefaultHttpManager::OpenL" );
   480     // Override dialog preferences
   497     // Override dialog preferences
   481     // Use if IAP is provided, override the default one
   498     // Use if IAP is provided, override the default one
   482     if ( iIapNumber )
   499     if ( iIapNumber )
   483         {
   500         {
   484         iCommDbPrefs.SetDialogPreference( ECommDbDialogPrefDoNotPrompt );
   501         iExtPrefs.SetNoteBehaviour(
   485         iCommDbPrefs.SetIapId( iIapNumber );
   502             TExtendedConnPref::ENoteBehaviourConnSilent );
   486         }
   503         iExtPrefs.SetIapId( iIapNumber );
   487 
   504         }
   488     // Start RConnection using specified CommDb preferences overrides
   505     else
   489     // This is async call, thus - signal CWmDrmDlaDefaultHttpManager is active
   506         {
   490     // (SetActive())
   507         iExtPrefs.SetSnapPurpose( CMManager::ESnapPurposeInternet );
   491     iCommDbPrefs.SetDirection( ECommDbConnectionDirectionOutgoing );
   508         iExtPrefs.SetNoteBehaviour(
   492     iConnection.Start( iCommDbPrefs, iStatus );
   509             TExtendedConnPref::ENoteBehaviourDefault );
       
   510         }
       
   511     iPrefList.AppendL( &iExtPrefs );
       
   512 
       
   513     iConnection.Start( iPrefList, iStatus );
   493 
   514 
   494     SetActive();
   515     SetActive();
       
   516     LOG1( "CWmDrmDlaDefaultHttpManager::OpenL - Socket connection started" );
       
   517 
   495     iState = EOpen;
   518     iState = EOpen;
   496     }
   519     }
   497 
   520 
   498 // ----------------------------------------------------------------------------
   521 // ----------------------------------------------------------------------------
       
   522 // CHttpManager::ReconnectL
       
   523 // Handler for the EOpenFailed state.
       
   524 // ----------------------------------------------------------------------------
       
   525 void CWmDrmDlaDefaultHttpManager::ReconnectL()
       
   526     {
       
   527     LOGFN( "CWmDrmDlaDefaultHttpManager::ReconnectL" );
       
   528 
       
   529     // Clear values set by OpenL
       
   530     for ( TInt i( 0 ); i<iPrefList.Count(); ++i )
       
   531         {
       
   532         iPrefList.Remove(i);
       
   533         }
       
   534 
       
   535     // Set as dialog based connection opening Any connection will do.
       
   536     iExtPrefs.SetIapId( 0 );
       
   537     iExtPrefs.SetSnapId( 0 );
       
   538     iExtPrefs.SetSnapPurpose( CMManager::ESnapPurposeUnknown );
       
   539     iExtPrefs.SetConnSelectionDialog( ETrue );
       
   540     iExtPrefs.SetNoteBehaviour(
       
   541         TExtendedConnPref::ENoteBehaviourDefault );
       
   542     iExtPrefs.SetForcedRoaming( EFalse );
       
   543     iExtPrefs.SetBearerSet( TExtendedConnPref::EExtendedConnBearerUnknown );
       
   544 
       
   545 
       
   546     iPrefList.AppendL( &iExtPrefs );
       
   547     iConnection.Start( iPrefList, iStatus );
       
   548 
       
   549     SetActive();
       
   550     LOG1( "CHttpManager::ReconnectL - Socket connection started" );
       
   551 
       
   552     iState = EReconnect;
       
   553 
       
   554     }
       
   555 
       
   556 // ----------------------------------------------------------------------------
   499 // CWmDrmDlaDefaultHttpManager::SubmitL
   557 // CWmDrmDlaDefaultHttpManager::SubmitL
   500 // Handler for the EOpen state.
   558 // Handler for the states EOpen and EReconnect.
   501 // ----------------------------------------------------------------------------
   559 // ----------------------------------------------------------------------------
   502 void CWmDrmDlaDefaultHttpManager::SubmitL()
   560 void CWmDrmDlaDefaultHttpManager::SubmitL()
   503     {
   561     {
   504     LOGFN( "CWmDrmDlaDefaultHttpManager::SubmitL" );
   562     LOGFN( "CWmDrmDlaDefaultHttpManager::SubmitL" );
   505     
   563 
   506     TConnectionInfo info;
   564     TConnectionInfo info;
   507     GetConnectionInfoL( info );
   565     GetConnectionInfoL( info );
   508     iIapNumber = info.iIapId;
   566     iIapNumber = info.iIapId;
   509     
   567 
   510     // Open session
   568     // Open session
   511     iHttpSession.OpenL();
   569     iHttpSession.OpenL();
   512     RStringPool pool = iHttpSession.StringPool();
   570     RStringPool pool = iHttpSession.StringPool();
   513     
   571 
   514     // Associate HTTP session with connection
   572     // Associate HTTP session with connection
   515     RHTTPConnectionInfo connInfo = iHttpSession.ConnectionInfo();
   573     RHTTPConnectionInfo connInfo = iHttpSession.ConnectionInfo();
   516     
   574 
   517     // Specify socket server
   575     // Specify socket server
   518     SET_HTTP_PROPERTY( connInfo, pool, HTTP::EHttpSocketServ, 
   576     SET_HTTP_PROPERTY( connInfo, pool, HTTP::EHttpSocketServ,
   519         iSocketServer.Handle() );
   577         iSocketServer.Handle() );
   520     // Specify connectionn to use
   578     // Specify connectionn to use
   521     TInt connPtr = reinterpret_cast<TInt>(&iConnection);
   579     TInt connPtr = reinterpret_cast<TInt>(&iConnection);
   522     SET_HTTP_PROPERTY( connInfo, pool, HTTP::EHttpSocketConnection, connPtr );
   580     SET_HTTP_PROPERTY( connInfo, pool, HTTP::EHttpSocketConnection, connPtr );
   523 
   581 
   524     // Install HTTP authentication filter
   582     // Install HTTP authentication filter
   525     InstallAuthenticationL( iHttpSession );
   583     InstallAuthenticationL( iHttpSession );
   526 
   584 
   527     CHttpCookieFilter::InstallFilterL( iHttpSession );
   585     CHttpCookieFilter::InstallFilterL( iHttpSession );
   528     
   586 
   529     RHTTPFilterCollection filterColl = iHttpSession.FilterCollection();
   587     RHTTPFilterCollection filterColl = iHttpSession.FilterCollection();
   530     filterColl.RemoveFilter( 
   588     filterColl.RemoveFilter(
   531         iHttpSession.StringPool().StringF( 
   589         iHttpSession.StringPool().StringF(
   532             HTTP::ERedirect, RHTTPSession::GetTable() ) );
   590             HTTP::ERedirect, RHTTPSession::GetTable() ) );
   533     
   591 
   534     CHttpUAProfFilterInterface::InstallFilterL( iHttpSession );
   592     CHttpUAProfFilterInterface::InstallFilterL( iHttpSession );
   535     
   593 
   536     // Parse URI
   594     // Parse URI
   537     TUriParser8 srcAddress;
   595     TUriParser8 srcAddress;
   538     User::LeaveIfError( srcAddress.Parse( *iSrcAddress ) );
   596     User::LeaveIfError( srcAddress.Parse( *iSrcAddress ) );
   539 
   597 
   540     // Open HTTP transaction
   598     // Open HTTP transaction
   541     iHttpTransaction = iHttpSession.OpenTransactionL( srcAddress, *this,
   599     iHttpTransaction = iHttpSession.OpenTransactionL( srcAddress, *this,
   542         HTTP_STRING( (EGet == iOperation) ? HTTP::EGET : HTTP::EPOST ) );
   600         HTTP_STRING( (EGet == iOperation) ? HTTP::EGET : HTTP::EPOST ) );
   543     iTransactionOpen = ETrue;
   601     iTransactionOpen = ETrue;
   544     
   602 
   545     // Set the data supplier if a POST operation
   603     // Set the data supplier if a POST operation
   546     if ( EPost == iOperation )
   604     if ( EPost == iOperation )
   547         {
   605         {
   548         iHttpTransaction.Request().SetBody( *iDataSupplier );
   606         iHttpTransaction.Request().SetBody( *iDataSupplier );
   549         }
   607         }
   550 
   608 
   551     
   609 
   552     TInt pos = iSrcAddress->Locate( '?' );
   610     TInt pos = iSrcAddress->Locate( '?' );
   553 
   611 
   554     // If no query ('?') pos is rightmost character
   612     // If no query ('?') pos is rightmost character
   555     pos = (pos != KErrNotFound) ? pos : iSrcAddress->Length();
   613     pos = (pos != KErrNotFound) ? pos : iSrcAddress->Length();
   556     TPtrC8 ptrUrl = iSrcAddress->Left( pos );
   614     TPtrC8 ptrUrl = iSrcAddress->Left( pos );
   557     
   615 
   558     // Only print if there is a ('?') and something to print after it
   616     // Only print if there is a ('?') and something to print after it
   559     if ( pos < iSrcAddress->Length() )
   617     if ( pos < iSrcAddress->Length() )
   560       {
   618       {
   561       TPtrC8 ptrQs = iSrcAddress->Mid( pos );
   619       TPtrC8 ptrQs = iSrcAddress->Mid( pos );
   562       }
   620       }
   601 
   659 
   602     if ( (iState == EOpen) && iKeepAlive )
   660     if ( (iState == EOpen) && iKeepAlive )
   603         {
   661         {
   604         TConnectionInfo connectionInfo;
   662         TConnectionInfo connectionInfo;
   605         GetConnectionInfoL(connectionInfo);
   663         GetConnectionInfoL(connectionInfo);
   606         if ( connectionInfo.iIapId != iIapNumber && 
   664         if ( connectionInfo.iIapId != iIapNumber &&
   607              iIapNumber != 0 && connectionInfo.iIapId != 0 )
   665              iIapNumber != 0 && connectionInfo.iIapId != 0 )
   608             {
   666             {
   609             CleanupConnection();
   667             CleanupConnection();
   610             iState = EStart;
   668             iState = EStart;
   611             }
   669             }
   623 
   681 
   624 // ----------------------------------------------------------------------------
   682 // ----------------------------------------------------------------------------
   625 // CWmDrmDlaDefaultHttpManager::HandleDownloadComplete
   683 // CWmDrmDlaDefaultHttpManager::HandleDownloadComplete
   626 // Close HTTP connection and clean up instance variables.
   684 // Close HTTP connection and clean up instance variables.
   627 //
   685 //
   628 // Must be called to complete client's request and cleanup, either on 
   686 // Must be called to complete client's request and cleanup, either on
   629 // successful download, or some error condition
   687 // successful download, or some error condition
   630 // ----------------------------------------------------------------------------
   688 // ----------------------------------------------------------------------------
   631 void CWmDrmDlaDefaultHttpManager::HandleDownloadComplete( TInt aError )
   689 void CWmDrmDlaDefaultHttpManager::HandleDownloadComplete( TInt aError )
   632     {
   690     {
   633     LOGFN( "CWmDrmDlaDefaultHttpManager::HandleDownloadComplete" );
   691     LOGFN( "CWmDrmDlaDefaultHttpManager::HandleDownloadComplete" );
   634     LOG2( "aError: %d", aError ); 
   692     LOG2( "aError: %d", aError );
   635     CleanupTransaction();
   693     CleanupTransaction();
   636 
   694 
   637     iInCallback = ETrue;
   695     iInCallback = ETrue;
   638     iObserver.OnTransactionComplete( aError );
   696     iObserver.OnTransactionComplete( aError );
   639     iInCallback = EFalse;
   697     iInCallback = EFalse;
   686         }
   744         }
   687     else
   745     else
   688         {
   746         {
   689         // do nothing. This is to get rid of a PC-Lint warning
   747         // do nothing. This is to get rid of a PC-Lint warning
   690         }
   748         }
   691             
   749 
   692     iTransactionOpen = EFalse;
   750     iTransactionOpen = EFalse;
   693     }
   751     }
   694 
   752 
   695 // ----------------------------------------------------------------------------
   753 // ----------------------------------------------------------------------------
   696 // CWmDrmDlaDefaultHttpManager::CleanupConnection
   754 // CWmDrmDlaDefaultHttpManager::CleanupConnection