omadrm/drmengine/roap/src/RoapHttpHandler.cpp
branchRCL_3
changeset 26 1221b68b8a5f
parent 12 8a03a285ab14
child 27 1481bf457703
equal deleted inserted replaced
25:50c53e893c3f 26:1221b68b8a5f
     1 /*
     1 /*
     2 * Copyright (c) 2002-2008 Nokia Corporation and/or its subsidiary(-ies).
     2 * Copyright (c) 2002-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".
    19 // INCLUDE FILES
    19 // INCLUDE FILES
    20 #include <stringpool.h>
    20 #include <stringpool.h>
    21 #include <http/thttphdrval.h>
    21 #include <http/thttphdrval.h>
    22 #include <httpfiltercommonstringsext.h>
    22 #include <httpfiltercommonstringsext.h>
    23 
    23 
    24 #include "RoapHttpHandler.h"
       
    25 #include "RoapObserver.h"
       
    26 #include "RoapDef.h"
       
    27 #include "RoapLog.h"
       
    28 
       
    29 //#include <CookieFilterInterface.h>
    24 //#include <CookieFilterInterface.h>
    30 //#include <uaproffilter_interface.h>
    25 //#include <uaproffilter_interface.h>
    31 //#include <HttpFilterProxyInterface.h>
    26 //#include <HttpFilterProxyInterface.h>
    32 #include <httpfilteriopinterface.h>
    27 #include <httpfilteriopinterface.h>
    33 
    28 
       
    29 #include "RoapHttpHandler.h"
       
    30 #include "RoapConnection.h"
       
    31 #include "RoapResponse.h"
       
    32 #include "RoapObserver.h"
       
    33 #include "RoapDef.h"
       
    34 #include "RoapLog.h"
       
    35 
       
    36 #include "buffercontainers.h"
       
    37 
    34 
    38 
    35 using namespace Roap;
    39 using namespace Roap;
    36 
    40 
    37 // ================= CONSTANTS ======================
    41 // ================= CONSTANTS ======================
    38 
    42 
    39 // The time out value in HTTP, 30 sec
    43 // The time out value in HTTP, 30 sec
    40 LOCAL_D const TInt KRoapTimeoutValue = 60000000;
    44 LOCAL_D const TInt KRoapTimeoutValue = 60000000;
    41 
    45 
    42 _LIT8( KTestUserName, "iopvf" );
    46 _LIT8( KTestUserName, "" );
    43 _LIT8( KTestPassword, "r72005" );
    47 _LIT8( KTestPassword, "" );
    44 /*
       
    45 _LIT8( KTestUserName, "moria" );
       
    46 _LIT8( KTestPassword, "mellon" );
       
    47 */
       
    48 
    48 
    49 // ================= MEMBER FUNCTIONS =======================
    49 // ================= MEMBER FUNCTIONS =======================
    50 
    50 
    51 // ---------------------------------------------------------
    51 // ---------------------------------------------------------
    52 // CRoapHttpHandler::NewL()
    52 // CRoapHttpHandler::NewL()
   562 
   562 
   563         case THTTPEvent::ERedirectRequiresConfirmation:
   563         case THTTPEvent::ERedirectRequiresConfirmation:
   564             {
   564             {
   565             LOG( _L("HTTP event ERedirectRequiresConfirmation received") );
   565             LOG( _L("HTTP event ERedirectRequiresConfirmation received") );
   566             iTransaction.SubmitL();
   566             iTransaction.SubmitL();
       
   567             break;
   567             }
   568             }
   568 
   569 
   569         default:
   570         default:
   570             {
   571             {
   571             LOG( _L("Unknown HTTP event recieved") );
   572             LOG( _L("Unknown HTTP event recieved") );
   639             iResponse->iDataType = TDataType( contentTypeVal.StrF().DesC() );
   640             iResponse->iDataType = TDataType( contentTypeVal.StrF().DesC() );
   640             }
   641             }
   641 
   642 
   642         if ( iResponse->iDataType == TDataType( KMultipartRelatedType ) )
   643         if ( iResponse->iDataType == TDataType( KMultipartRelatedType ) )
   643             {
   644             {
   644             TPath tempPath;
   645             DRM::CPathContainer* tempPath( DRM::CPathContainer::NewLC() );
   645             TFileName fileName;
   646             DRM::CFileNameContainer* fileName( DRM::CFileNameContainer::NewLC() );
   646             TInt maxSize( 0 );
   647             TInt maxSize( 0 );
   647 
   648 
   648             if ( iObserver )
   649             if ( iObserver )
   649                 {
   650                 {
   650                 iObserver->ContentDownloadInfoL( tempPath, fileName, maxSize );
   651                 iObserver->ContentDownloadInfoL( tempPath->iBuffer, fileName->iBuffer, maxSize );
   651                 }
   652                 }
   652 
   653 
   653             boundaryStr = srtPool.StringF( HttpFilterCommonStringsExt::EBoundary,
   654             boundaryStr = srtPool.StringF( HttpFilterCommonStringsExt::EBoundary,
   654                                            HttpFilterCommonStringsExt::GetTable() );
   655                                            HttpFilterCommonStringsExt::GetTable() );
   655 
   656 
   664                 {
   665                 {
   665                 // a multipart without boundary param
   666                 // a multipart without boundary param
   666                 LOG( _L("Error: multipart boundary missing") );
   667                 LOG( _L("Error: multipart boundary missing") );
   667                    User::Leave( KErrRoapGeneral );
   668                    User::Leave( KErrRoapGeneral );
   668                 }
   669                 }
   669             iResponse->SetDcfPathL( tempPath );
   670             iResponse->SetDcfPathL( tempPath->iBuffer );
   670             iResponse->SetContentNameL( fileName );
   671             iResponse->SetContentNameL( fileName->iBuffer );
       
   672             CleanupStack::PopAndDestroy( fileName );
       
   673             CleanupStack::PopAndDestroy( tempPath );
   671             iReportBytes = ETrue;
   674             iReportBytes = ETrue;
   672 
   675 
   673             if ( iObserver )
   676             if ( iObserver )
   674                 {
   677                 {
   675                 iObserver->RoapProgressInfoL( KRoapProgressMax );
   678                 iObserver->RoapProgressInfoL( KRoapProgressMax );