--- a/wmdrm/camese/wmdrmdladefaulthttpplugin/group/wmdrmdladefaulthttpplugin.mmp Thu Dec 17 08:52:27 2009 +0200
+++ b/wmdrm/camese/wmdrmdladefaulthttpplugin/group/wmdrmdladefaulthttpplugin.mmp Thu Jan 07 12:54:19 2010 +0200
@@ -1,5 +1,5 @@
/*
-* Copyright (c) 2008 Nokia Corporation and/or its subsidiary(-ies).
+* Copyright (c) 2008-2009 Nokia Corporation and/or its subsidiary(-ies).
* All rights reserved.
* This component and the accompanying materials are made available
* under the terms of "Eclipse Public License v1.0"
@@ -29,15 +29,15 @@
SOURCEPATH ../src
SOURCE wmdrmdladefaulthttppluginproxy.cpp
SOURCE wmdrmdladefaulthttpplugin.cpp
-SOURCE wmdrmdladefaultlicacq.cpp
-SOURCE wmdrmdladefaultmetering.cpp
-SOURCE wmdrmdladefaultplayready.cpp
-SOURCE wmdrmdladefaulthttpmanager.cpp
+SOURCE wmdrmdladefaultlicacq.cpp
+SOURCE wmdrmdladefaultmetering.cpp
+SOURCE wmdrmdladefaultplayready.cpp
+SOURCE wmdrmdladefaulthttpmanager.cpp
USERINCLUDE ../inc
-USERINCLUDE ../../wmdrmdlautils/inc
-USERINCLUDE ../../../inc
-USERINCLUDE ../../../wmdrmengine/asf/inc
+USERINCLUDE ../../wmdrmdlautils/inc
+USERINCLUDE ../../../inc
+USERINCLUDE ../../../wmdrmengine/asf/inc
MW_LAYER_SYSTEMINCLUDE
SYSTEMINCLUDE /epoc32/include/ecom
@@ -47,17 +47,18 @@
END
LIBRARY euser.lib
-LIBRARY flogger.lib
-LIBRARY ecom.lib
-LIBRARY bafl.lib
-LIBRARY http.lib
+LIBRARY flogger.lib
+LIBRARY ecom.lib
+LIBRARY bafl.lib
+LIBRARY http.lib
LIBRARY inetprotutil.lib
-LIBRARY commdb.lib
+LIBRARY extendedconnpref.lib
+LIBRARY netmeta.lib
LIBRARY esock.lib
-LIBRARY estor.lib
-LIBRARY charconv.lib
-LIBRARY wmdrmdla.lib
-LIBRARY wmdrmdlautils.lib
-LIBRARY drmasf.lib
+LIBRARY estor.lib
+LIBRARY charconv.lib
+LIBRARY wmdrmdla.lib
+LIBRARY wmdrmdlautils.lib
+LIBRARY drmasf.lib
SMPSAFE
--- a/wmdrm/camese/wmdrmdladefaulthttpplugin/inc/wmdrmdladefaulthttpmanager.h Thu Dec 17 08:52:27 2009 +0200
+++ b/wmdrm/camese/wmdrmdladefaulthttpplugin/inc/wmdrmdladefaulthttpmanager.h Thu Jan 07 12:54:19 2010 +0200
@@ -1,5 +1,5 @@
/*
-* Copyright (c) 2008 Nokia Corporation and/or its subsidiary(-ies).
+* Copyright (c) 2008-2009 Nokia Corporation and/or its subsidiary(-ies).
* All rights reserved.
* This component and the accompanying materials are made available
* under the terms of "Eclipse Public License v1.0"
@@ -30,7 +30,7 @@
#include <http/mhttptransactioncallback.h>
#include <http/mhttpdatasupplier.h>
-#include <commdbconnpref.h> // TCommDbConnPref (since 7.0s)
+#include <extendedconnpref.h> // TExtendedConnPref, TConnPrefList, TConnectionInfo
#include "wmdrmdladefaulthttpmanagerobserver.h"
@@ -50,7 +50,7 @@
struct THeader
{
public:
- inline THeader( TInt aField, const TDesC8& aDesC ) :
+ inline THeader( TInt aField, const TDesC8& aDesC ) :
iField(aField), iVal(aDesC) {};
public:
TInt iField; // e.g. 'HTTP::EAccept'
@@ -63,7 +63,7 @@
* @param aObserver - reference to observer
* @return address of an instance of this class
*/
- static CWmDrmDlaDefaultHttpManager* NewL(
+ static CWmDrmDlaDefaultHttpManager* NewL(
MWmDrmDlaDefaltHttpManagerObserver& aObserver );
/**
@@ -72,7 +72,7 @@
* @param aIapNumber - Internet Access Point to be used
* @return address of an instance of this class
*/
- static CWmDrmDlaDefaultHttpManager* NewL(
+ static CWmDrmDlaDefaultHttpManager* NewL(
MWmDrmDlaDefaltHttpManagerObserver& aObserver,
TUint32 aIapNumber );
@@ -84,7 +84,7 @@
/**
* Called to start the GET transaction using the configured IAP.
* @param aUrl - URL to be used for the transaction
- * @param aHeaders - a list of headers and their values to be
+ * @param aHeaders - a list of headers and their values to be
* included with the HTTP request
*/
void Get( const TDesC8& aUrl, const RArray<THeader>& aHeaders );
@@ -92,11 +92,11 @@
/**
* Called to start the POST transaction using the configured IAP.
* @param aUrl - URL to be used for the transaction
- * @param aHeaders - a list of headers and their values to be
+ * @param aHeaders - a list of headers and their values to be
* included with the HTTP request
* @param aDataSupplier - interface to be used to get the POST data
*/
- void Post( const TDesC8& aUrl, const RArray<THeader>& aHeaders,
+ void Post( const TDesC8& aUrl, const RArray<THeader>& aHeaders,
MHTTPDataSupplier* aDataSupplier );
/**
@@ -139,41 +139,41 @@
* @param aIapId The IAP connection that will be used
*/
void SetIapId( TInt aIapId );
-
+
/**
* Get the IAP Connection ID
*/
TInt IapId();
private: // From MHTTPTransactionCallback
-
- virtual void MHFRunL( RHTTPTransaction aTransaction,
+
+ virtual void MHFRunL( RHTTPTransaction aTransaction,
const THTTPEvent& aEvent );
- virtual TInt MHFRunError( TInt aError, RHTTPTransaction aTransaction,
+ virtual TInt MHFRunError( TInt aError, RHTTPTransaction aTransaction,
const THTTPEvent& aEvent );
private: // From MHTTPAuthenticationCallback
-
- virtual TBool GetCredentialsL( const TUriC8& aURI, RString aRealm,
+
+ virtual TBool GetCredentialsL( const TUriC8& aURI, RString aRealm,
RStringF aAuthenticationType,
- RString& aUsername,
+ RString& aUsername,
RString& aPassword );
private: // From CActive
-
+
void DoCancel();
void RunL();
TInt RunError(TInt aError);
private:
-
+
/**
* Contructor
* @param aObserver An observer to monitor the HTTP communications
* @param aIap An IAP connection to use for HTTP communication
*/
- CWmDrmDlaDefaultHttpManager(
- MWmDrmDlaDefaltHttpManagerObserver& aObserver,
+ CWmDrmDlaDefaultHttpManager(
+ MWmDrmDlaDefaltHttpManagerObserver& aObserver,
TUint32 aIapNumber );
/**
@@ -182,7 +182,7 @@
void ConstructL();
private:
-
+
// State transition handlers
/**
* Handler for the EStart state.
@@ -191,9 +191,13 @@
/**
* Handler for the EInitialize state.
*/
- void Open();
+ void OpenL();
/**
- * Handler for the EOpen state.
+ * Handler for the EOpenFailed state.
+ */
+ void ReconnectL();
+ /**
+ * Handler for the states EOpen and EReconnect.
*/
void SubmitL();
@@ -218,7 +222,7 @@
/**
* Set the HTTP header to send
*/
- void SetHeaderL( RHTTPHeaders& aHeaders, TInt aHdrField,
+ void SetHeaderL( RHTTPHeaders& aHeaders, TInt aHdrField,
const TDesC8& aHdrValue ) const;
/**
* Delete the username and password used in authentication
@@ -226,7 +230,7 @@
void DeleteUsernamePassword();
private: // Private types
-
+
// Asynchronous connection states
enum TState
{
@@ -234,6 +238,8 @@
EStart,
EInitialize,
EOpen,
+ EOpenFailed,
+ EReconnect,
ESubmit
};
@@ -245,7 +251,7 @@
};
private: // Data
-
+
MWmDrmDlaDefaltHttpManagerObserver& iObserver;
TState iState; // State of the asynch connection
@@ -254,7 +260,9 @@
RSocketServ iSocketServer;
RConnection iConnection;
- TCommDbConnPref iCommDbPrefs;
+
+ TConnPrefList iPrefList;
+ TExtendedConnPref iExtPrefs;
TUint32 iIapNumber;
--- a/wmdrm/camese/wmdrmdladefaulthttpplugin/src/wmdrmdladefaulthttpmanager.cpp Thu Dec 17 08:52:27 2009 +0200
+++ b/wmdrm/camese/wmdrmdladefaulthttpplugin/src/wmdrmdladefaulthttpmanager.cpp Thu Jan 07 12:54:19 2010 +0200
@@ -1,5 +1,5 @@
/*
-* Copyright (c) 2008 Nokia Corporation and/or its subsidiary(-ies).
+* Copyright (c) 2008-2009 Nokia Corporation and/or its subsidiary(-ies).
* All rights reserved.
* This component and the accompanying materials are made available
* under the terms of "Eclipse Public License v1.0"
@@ -27,9 +27,9 @@
/**
* HTTP_STRING macro
- * To use HTTP_STRING macro you need a variable 'pool' defined (of
+ * To use HTTP_STRING macro you need a variable 'pool' defined (of
* RStringPool type).
- * @param aStringId - an ID for string from HTTP Client's string table
+ * @param aStringId - an ID for string from HTTP Client's string table
* (e.g. 'HTTP::EAccept')
*/
#define HTTP_STRING(aStringId)pool.StringF(aStringId, RHTTPSession::GetTable())
@@ -51,11 +51,11 @@
// ----------------------------------------------------------------------------
// CWmDrmDlaDefaultHttpManager::NewL
// ----------------------------------------------------------------------------
-CWmDrmDlaDefaultHttpManager* CWmDrmDlaDefaultHttpManager::NewL(
+CWmDrmDlaDefaultHttpManager* CWmDrmDlaDefaultHttpManager::NewL(
MWmDrmDlaDefaltHttpManagerObserver& aObserver )
{
LOGFN( "CWmDrmDlaDefaultHttpManager::NewL(1)" );
- CWmDrmDlaDefaultHttpManager* self =
+ CWmDrmDlaDefaultHttpManager* self =
new(ELeave) CWmDrmDlaDefaultHttpManager( aObserver, 0 );
CleanupStack::PushL( self );
self->ConstructL();
@@ -66,12 +66,12 @@
// ----------------------------------------------------------------------------
// CWmDrmDlaDefaultHttpManager::NewL
// ----------------------------------------------------------------------------
-CWmDrmDlaDefaultHttpManager* CWmDrmDlaDefaultHttpManager::NewL(
+CWmDrmDlaDefaultHttpManager* CWmDrmDlaDefaultHttpManager::NewL(
MWmDrmDlaDefaltHttpManagerObserver& aObserver,
TUint32 aIapNumber )
{
LOGFN( "CWmDrmDlaDefaultHttpManager::NewL(2)" );
- CWmDrmDlaDefaultHttpManager* self =
+ CWmDrmDlaDefaultHttpManager* self =
new(ELeave) CWmDrmDlaDefaultHttpManager( aObserver, aIapNumber );
CleanupStack::PushL( self );
self->ConstructL();
@@ -201,7 +201,7 @@
// const but aConnectionInfo is being changed after it has been put into a
// package and GetConnectionInfo is called on the connection
// ----------------------------------------------------------------------------
-void CWmDrmDlaDefaultHttpManager::GetConnectionInfoL(
+void CWmDrmDlaDefaultHttpManager::GetConnectionInfoL(
TConnectionInfo& aConnectionInfo )
{
LOGFN( "CWmDrmDlaDefaultHttpManager::GetConnectionInfoL" );
@@ -244,42 +244,42 @@
// ----------------------------------------------------------------------------
// CWmDrmDlaDefaultHttpManager::MHFRunL
// ----------------------------------------------------------------------------
-void CWmDrmDlaDefaultHttpManager::MHFRunL(
- RHTTPTransaction aTransaction,
+void CWmDrmDlaDefaultHttpManager::MHFRunL(
+ RHTTPTransaction aTransaction,
const THTTPEvent& aEvent )
{
LOGFN( "CWmDrmDlaDefaultHttpManager::MHFRunL" );
RHTTPResponse response;
TPtrC8 dataChunk;
-
+
// Either ESucceeded or EFailed will eventually occur
switch ( aEvent.iStatus )
{
case THTTPEvent::EGotResponseHeaders:
response = aTransaction.Response();
-
+
iInCallback = ETrue;
iObserver.OnResponseHeadersL(
response,
response.GetHeaderCollection(),
iHttpSession.StringPool(),
response.StatusCode() );
-
+
break;
-
+
case THTTPEvent::EGotResponseBodyData:
- // A member variable is used to store the body to avoid two
+ // A member variable is used to store the body to avoid two
// potential problems:
// - OnResponseBodyDataL leaves
// - Stop is called from within OnResponseBodyDataL
iBody = aTransaction.Response().Body();
User::LeaveIfNull( iBody );
-
+
iBody->GetNextDataPart( dataChunk );
-
+
iInCallback = ETrue;
iObserver.OnResponseBodyDataL( dataChunk );
-
+
// Verify that iBody wasn't already released
// for example by calling Stop within ResponseBodyDataL
if ( iBody )
@@ -287,18 +287,18 @@
iBody->ReleaseData();
iBody = NULL;
}
-
+
break;
-
+
case THTTPEvent::ESucceeded:
case THTTPEvent::EFailed:
- // Deal with both the same as iError will either be negative or
+ // Deal with both the same as iError will either be negative or
// KErrNone
- // If the user cancelled the credentials dialog then make sure we
+ // If the user cancelled the credentials dialog then make sure we
// return KErrCancel
HandleDownloadComplete( iCredentialsOk ? iError : KErrCancel );
break;
-
+
default:
// This will capture system and HTTP lib errors
// For positive codes iError will remain to KErrNone
@@ -346,13 +346,13 @@
// Get the username/password
iInCallback = ETrue;
- iCredentialsOk =
+ iCredentialsOk =
iObserver.OnGetUsernamePasswordL( iUsername, iPassword );
iInCallback = EFalse;
// authentication = iCredentialsOk && iUsername && iPassword
// no authentication = !iCredentialsOk && !iUsername && !iPassword
- ASSERT( (iCredentialsOk && iUsername && iPassword) ||
+ ASSERT( (iCredentialsOk && iUsername && iPassword) ||
(!iCredentialsOk && !iUsername && !iPassword ) );
if (iCredentialsOk)
@@ -373,7 +373,17 @@
void CWmDrmDlaDefaultHttpManager::RunL()
{
LOGFN( "CWmDrmDlaDefaultHttpManager::RunL" );
- User::LeaveIfError( iStatus.Int() );
+ TInt error( iStatus.Int() );
+ LOG3( "CWmDrmDlaDefaultHttpManager State: %d Status: %d", iState, error );
+
+ if ( iState == EOpen && error == KErrNotFound )
+ {
+ iState=EOpenFailed;
+ }
+ else
+ {
+ User::LeaveIfError( error );
+ }
switch (iState)
{
@@ -381,8 +391,15 @@
InitializeL();
break;
case EInitialize:
- Open();
+ OpenL();
+ break;
+ case EOpenFailed: // Called only if open fails
+ ReconnectL();
break;
+ case EReconnect:
+ iState=EOpen;
+ // Note: intentionally no break
+ // Successfully completed EReconnect is same as EOpen.
case EOpen:
SubmitL();
break;
@@ -393,7 +410,7 @@
}
// Do not advance the state if the transaction was submitted
- // MHFRunL will be called by the HTTP stack while the transaction
+ // MHFRunL will be called by the HTTP stack while the transaction
// progresses
if ( iState != ESubmit )
{
@@ -428,7 +445,7 @@
TInt CWmDrmDlaDefaultHttpManager::RunError( TInt aError )
{
LOGFN( "CWmDrmDlaDefaultHttpManager::RunError" );
- LOG2( "aError: %d", aError );
+ LOG2( "aError: %d", aError );
// Cleanup and generate the callback
HandleDownloadComplete( aError );
return KErrNone;
@@ -472,50 +489,91 @@
// ----------------------------------------------------------------------------
// CWmDrmDlaDefaultHttpManager::OpenL
-// Handler for the EInitialize state.
+// Handler for the EInitialize state.
// ----------------------------------------------------------------------------
-void CWmDrmDlaDefaultHttpManager::Open()
+void CWmDrmDlaDefaultHttpManager::OpenL()
{
- LOGFN( "CWmDrmDlaDefaultHttpManager::Open" );
+ LOGFN( "CWmDrmDlaDefaultHttpManager::OpenL" );
// Override dialog preferences
// Use if IAP is provided, override the default one
if ( iIapNumber )
{
- iCommDbPrefs.SetDialogPreference( ECommDbDialogPrefDoNotPrompt );
- iCommDbPrefs.SetIapId( iIapNumber );
+ iExtPrefs.SetNoteBehaviour(
+ TExtendedConnPref::ENoteBehaviourConnSilent );
+ iExtPrefs.SetIapId( iIapNumber );
+ }
+ else
+ {
+ iExtPrefs.SetSnapPurpose( CMManager::ESnapPurposeInternet );
+ iExtPrefs.SetNoteBehaviour(
+ TExtendedConnPref::ENoteBehaviourDefault );
+ }
+ iPrefList.AppendL( &iExtPrefs );
+
+ iConnection.Start( iPrefList, iStatus );
+
+ SetActive();
+ LOG1( "CWmDrmDlaDefaultHttpManager::OpenL - Socket connection started" );
+
+ iState = EOpen;
+ }
+
+// ----------------------------------------------------------------------------
+// CHttpManager::ReconnectL
+// Handler for the EOpenFailed state.
+// ----------------------------------------------------------------------------
+void CWmDrmDlaDefaultHttpManager::ReconnectL()
+ {
+ LOGFN( "CWmDrmDlaDefaultHttpManager::ReconnectL" );
+
+ // Clear values set by OpenL
+ for ( TInt i( 0 ); i<iPrefList.Count(); ++i )
+ {
+ iPrefList.Remove(i);
}
- // Start RConnection using specified CommDb preferences overrides
- // This is async call, thus - signal CWmDrmDlaDefaultHttpManager is active
- // (SetActive())
- iCommDbPrefs.SetDirection( ECommDbConnectionDirectionOutgoing );
- iConnection.Start( iCommDbPrefs, iStatus );
+ // Set as dialog based connection opening Any connection will do.
+ iExtPrefs.SetIapId( 0 );
+ iExtPrefs.SetSnapId( 0 );
+ iExtPrefs.SetSnapPurpose( CMManager::ESnapPurposeUnknown );
+ iExtPrefs.SetConnSelectionDialog( ETrue );
+ iExtPrefs.SetNoteBehaviour(
+ TExtendedConnPref::ENoteBehaviourDefault );
+ iExtPrefs.SetForcedRoaming( EFalse );
+ iExtPrefs.SetBearerSet( TExtendedConnPref::EExtendedConnBearerUnknown );
+
+
+ iPrefList.AppendL( &iExtPrefs );
+ iConnection.Start( iPrefList, iStatus );
SetActive();
- iState = EOpen;
+ LOG1( "CHttpManager::ReconnectL - Socket connection started" );
+
+ iState = EReconnect;
+
}
// ----------------------------------------------------------------------------
// CWmDrmDlaDefaultHttpManager::SubmitL
-// Handler for the EOpen state.
+// Handler for the states EOpen and EReconnect.
// ----------------------------------------------------------------------------
void CWmDrmDlaDefaultHttpManager::SubmitL()
{
LOGFN( "CWmDrmDlaDefaultHttpManager::SubmitL" );
-
+
TConnectionInfo info;
GetConnectionInfoL( info );
iIapNumber = info.iIapId;
-
+
// Open session
iHttpSession.OpenL();
RStringPool pool = iHttpSession.StringPool();
-
+
// Associate HTTP session with connection
RHTTPConnectionInfo connInfo = iHttpSession.ConnectionInfo();
-
+
// Specify socket server
- SET_HTTP_PROPERTY( connInfo, pool, HTTP::EHttpSocketServ,
+ SET_HTTP_PROPERTY( connInfo, pool, HTTP::EHttpSocketServ,
iSocketServer.Handle() );
// Specify connectionn to use
TInt connPtr = reinterpret_cast<TInt>(&iConnection);
@@ -525,14 +583,14 @@
InstallAuthenticationL( iHttpSession );
CHttpCookieFilter::InstallFilterL( iHttpSession );
-
+
RHTTPFilterCollection filterColl = iHttpSession.FilterCollection();
- filterColl.RemoveFilter(
- iHttpSession.StringPool().StringF(
+ filterColl.RemoveFilter(
+ iHttpSession.StringPool().StringF(
HTTP::ERedirect, RHTTPSession::GetTable() ) );
-
+
CHttpUAProfFilterInterface::InstallFilterL( iHttpSession );
-
+
// Parse URI
TUriParser8 srcAddress;
User::LeaveIfError( srcAddress.Parse( *iSrcAddress ) );
@@ -541,20 +599,20 @@
iHttpTransaction = iHttpSession.OpenTransactionL( srcAddress, *this,
HTTP_STRING( (EGet == iOperation) ? HTTP::EGET : HTTP::EPOST ) );
iTransactionOpen = ETrue;
-
+
// Set the data supplier if a POST operation
if ( EPost == iOperation )
{
iHttpTransaction.Request().SetBody( *iDataSupplier );
}
-
+
TInt pos = iSrcAddress->Locate( '?' );
// If no query ('?') pos is rightmost character
pos = (pos != KErrNotFound) ? pos : iSrcAddress->Length();
TPtrC8 ptrUrl = iSrcAddress->Left( pos );
-
+
// Only print if there is a ('?') and something to print after it
if ( pos < iSrcAddress->Length() )
{
@@ -603,7 +661,7 @@
{
TConnectionInfo connectionInfo;
GetConnectionInfoL(connectionInfo);
- if ( connectionInfo.iIapId != iIapNumber &&
+ if ( connectionInfo.iIapId != iIapNumber &&
iIapNumber != 0 && connectionInfo.iIapId != 0 )
{
CleanupConnection();
@@ -625,13 +683,13 @@
// CWmDrmDlaDefaultHttpManager::HandleDownloadComplete
// Close HTTP connection and clean up instance variables.
//
-// Must be called to complete client's request and cleanup, either on
+// Must be called to complete client's request and cleanup, either on
// successful download, or some error condition
// ----------------------------------------------------------------------------
void CWmDrmDlaDefaultHttpManager::HandleDownloadComplete( TInt aError )
{
LOGFN( "CWmDrmDlaDefaultHttpManager::HandleDownloadComplete" );
- LOG2( "aError: %d", aError );
+ LOG2( "aError: %d", aError );
CleanupTransaction();
iInCallback = ETrue;
@@ -688,7 +746,7 @@
{
// do nothing. This is to get rid of a PC-Lint warning
}
-
+
iTransactionOpen = EFalse;
}