omadrm/drmplugins/drmfilter/src/HTTPFilterDRM.cpp
changeset 31 908beac81e0a
parent 23 493788a4a8a4
child 49 69d8e75812b7
equal deleted inserted replaced
29:3bdc3b853094 31:908beac81e0a
     1 /*
     1 /*
     2  * Copyright (c) 2006 Nokia Corporation and/or its subsidiary(-ies).
     2  * Copyright (c) 2006-2010 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".
   215     delete this;
   215     delete this;
   216     }
   216     }
   217 
   217 
   218 //------------------------------------------------------------------------
   218 //------------------------------------------------------------------------
   219 // CHTTPFilterDRM::MHFRunL
   219 // CHTTPFilterDRM::MHFRunL
   220 // See MHTTPFilterBase::MHFRunL 
   220 // See MHTTPFilterBase::MHFRunL
   221 //------------------------------------------------------------------------
   221 //------------------------------------------------------------------------
   222 //
   222 //
   223 void CHTTPFilterDRM::MHFRunL( RHTTPTransaction aTransaction,
   223 void CHTTPFilterDRM::MHFRunL( RHTTPTransaction aTransaction,
   224     const THTTPEvent& aEvent )
   224     const THTTPEvent& aEvent )
   225     {
   225     {
   318         case KErrCANotSupported:
   318         case KErrCANotSupported:
   319         case KErrCANoPermission:
   319         case KErrCANoPermission:
   320         case KErrCANoRights:
   320         case KErrCANoRights:
   321         case KErrCorrupt:
   321         case KErrCorrupt:
   322             {
   322             {
   323             error = NW_STAT_FAILURE; //Unable to perform operation   
   323             error = NW_STAT_FAILURE; //Unable to perform operation
   324             }
   324             }
   325             break;
   325             break;
   326         case KErrArgument:
   326         case KErrArgument:
   327             {
   327             {
   328             error = KBadMimeType;
   328             error = KBadMimeType;
   459 
   459 
   460 //------------------------------------------------------------------------
   460 //------------------------------------------------------------------------
   461 // CHTTPFilterDRM::CheckHeadersL
   461 // CHTTPFilterDRM::CheckHeadersL
   462 // Check HTTP headers and extract MIME type
   462 // Check HTTP headers and extract MIME type
   463 //------------------------------------------------------------------------
   463 //------------------------------------------------------------------------
   464 // 
   464 //
   465 void CHTTPFilterDRM::CheckHeadersL( const RHTTPTransaction& aTrans )
   465 void CHTTPFilterDRM::CheckHeadersL( const RHTTPTransaction& aTrans )
   466     {
   466     {
   467     // read the header data and check the MIME type here    
   467     // read the header data and check the MIME type here
   468     // check the status and body
   468     // check the status and body
   469     RHTTPResponse response = aTrans.Response();
   469     RHTTPResponse response = aTrans.Response();
   470     TInt status = response.StatusCode();
   470     TInt status = response.StatusCode();
   471 
   471 
   472 #if defined (_DEBUG) && defined (_LOGGING)
   472 #if defined (_DEBUG) && defined (_LOGGING)
   510                 CHTTPFilterDRMDataSupplier* drmData = 0;
   510                 CHTTPFilterDRMDataSupplier* drmData = 0;
   511 
   511 
   512                 drmData = CHTTPFilterDRMDataSupplier::NewL( aTrans.Id(),
   512                 drmData = CHTTPFilterDRMDataSupplier::NewL( aTrans.Id(),
   513                     response.Body(), const_cast<CHTTPFilterDRM*> ( this ) );
   513                     response.Body(), const_cast<CHTTPFilterDRM*> ( this ) );
   514                 /** Support for Hutchinson's content protection scheme, CFM
   514                 /** Support for Hutchinson's content protection scheme, CFM
   515                  *  
   515                  *
   516                  */
   516                  */
   517                 drmData->SetProcessedContentType( EStandardDRMContent );
   517                 drmData->SetProcessedContentType( EStandardDRMContent );
   518                 /**
   518                 /**
   519                  *
   519                  *
   520                  */
   520                  */
   628         CleanupStack::PopAndDestroy( &cfmValStr );
   628         CleanupStack::PopAndDestroy( &cfmValStr );
   629 
   629 
   630         // Do not encrypt JAD files:
   630         // Do not encrypt JAD files:
   631         if ( headers.GetField( fieldNameStr, 0, fieldVal ) == KErrNone )
   631         if ( headers.GetField( fieldNameStr, 0, fieldVal ) == KErrNone )
   632             {
   632             {
   633             // If it is a JAD always ignore any of the above:   
   633             // If it is a JAD always ignore any of the above:
   634             const TBuf8<sizeof( KJADString )> JADStringBuf( KJADString );
   634             const TBuf8<sizeof( KJADString )> JADStringBuf( KJADString );
   635             RStringF JADValue = strP.OpenFStringL( JADStringBuf );
   635             RStringF JADValue = strP.OpenFStringL( JADStringBuf );
   636             CleanupClosePushL( JADValue );
   636             CleanupClosePushL( JADValue );
   637 
   637 
   638             RStringF jadFieldValStr = strP.StringF( fieldVal.StrF() );
   638             RStringF jadFieldValStr = strP.StringF( fieldVal.StrF() );
   663                 }
   663                 }
   664 
   664 
   665             iDataSups.Append( drmData );
   665             iDataSups.Append( drmData );
   666             response.SetBody( *drmData );
   666             response.SetBody( *drmData );
   667 
   667 
   668             ///         
   668             ///
   669             RStringF DRMValue1 = strP.OpenFStringL( DRMStringBuf1 );
   669             RStringF DRMValue1 = strP.OpenFStringL( DRMStringBuf1 );
   670             CleanupClosePushL( DRMValue1 );
   670             CleanupClosePushL( DRMValue1 );
   671 
   671 
   672             RStringF DRMValue3 = strP.OpenFStringL( DRMStringBuf3 );
   672             RStringF DRMValue3 = strP.OpenFStringL( DRMStringBuf3 );
   673             CleanupClosePushL( DRMValue3 );
   673             CleanupClosePushL( DRMValue3 );