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