javacommons/gcfprotocols/http/src.s60/chttptransactionclient.cpp
author hgs
Fri, 29 Oct 2010 11:49:32 +0300
changeset 87 1627c337e51e
parent 80 d6dafc5d983f
permissions -rw-r--r--
v2.2.21_1
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
21
2a9601315dfc Revision: v2.1.22
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
     1
/*
2a9601315dfc Revision: v2.1.22
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
     2
* Copyright (c) 2008 Nokia Corporation and/or its subsidiary(-ies).
2a9601315dfc Revision: v2.1.22
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
     3
* All rights reserved.
2a9601315dfc Revision: v2.1.22
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
     4
* This component and the accompanying materials are made available
2a9601315dfc Revision: v2.1.22
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
     5
* under the terms of "Eclipse Public License v1.0"
2a9601315dfc Revision: v2.1.22
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
     6
* which accompanies this distribution, and is available
2a9601315dfc Revision: v2.1.22
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
     7
* at the URL "http://www.eclipse.org/legal/epl-v10.html".
2a9601315dfc Revision: v2.1.22
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
     8
*
2a9601315dfc Revision: v2.1.22
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
     9
* Initial Contributors:
2a9601315dfc Revision: v2.1.22
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
    10
* Nokia Corporation - initial contribution.
2a9601315dfc Revision: v2.1.22
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
    11
*
2a9601315dfc Revision: v2.1.22
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
    12
* Contributors:
2a9601315dfc Revision: v2.1.22
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
    13
*
2a9601315dfc Revision: v2.1.22
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
    14
* Description:  CHttpTransactionClient
2a9601315dfc Revision: v2.1.22
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
    15
*
2a9601315dfc Revision: v2.1.22
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
    16
*/
2a9601315dfc Revision: v2.1.22
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
    17
2a9601315dfc Revision: v2.1.22
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
    18
2a9601315dfc Revision: v2.1.22
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
    19
#include <http/rhttpresponse.h>
2a9601315dfc Revision: v2.1.22
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
    20
#include <http/rhttpheaders.h>
2a9601315dfc Revision: v2.1.22
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
    21
#include <httpstringconstants.h>
2a9601315dfc Revision: v2.1.22
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
    22
#include <http/thttphdrval.h>
2a9601315dfc Revision: v2.1.22
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
    23
#include <http/mhttpauthenticationcallback.h>
2a9601315dfc Revision: v2.1.22
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
    24
#include <httperr.h>
2a9601315dfc Revision: v2.1.22
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
    25
#include <stringpool.h>
2a9601315dfc Revision: v2.1.22
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
    26
#include <e32svr.h>
2a9601315dfc Revision: v2.1.22
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
    27
#include <x509cert.h>
2a9601315dfc Revision: v2.1.22
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
    28
#include <ssl.h>
2a9601315dfc Revision: v2.1.22
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
    29
#include "logger.h"
2a9601315dfc Revision: v2.1.22
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
    30
#include "chttptransactionclient.h"
2a9601315dfc Revision: v2.1.22
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
    31
#include "httpsessionclient.h"
2a9601315dfc Revision: v2.1.22
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
    32
#include "chttpscertinfo.h"
2a9601315dfc Revision: v2.1.22
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
    33
#include "mrefhttpclientobserver.h"
2a9601315dfc Revision: v2.1.22
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
    34
2a9601315dfc Revision: v2.1.22
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
    35
2a9601315dfc Revision: v2.1.22
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
    36
_LIT8(KSeperator , ";;");
2a9601315dfc Revision: v2.1.22
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
    37
_LIT8(KComma , ",");
2a9601315dfc Revision: v2.1.22
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
    38
_LIT8(KDot , ".");
2a9601315dfc Revision: v2.1.22
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
    39
_LIT8(KCommaSpace , ", ");
2a9601315dfc Revision: v2.1.22
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
    40
_LIT8(KSemiColonSpace , "; ");
2a9601315dfc Revision: v2.1.22
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
    41
_LIT8(KEquals , "=");
2a9601315dfc Revision: v2.1.22
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
    42
_LIT8(KDRMHeader1,"application/vnd.oma.drm.content");
2a9601315dfc Revision: v2.1.22
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
    43
_LIT8(KDRMHeader2,"application/vnd.oma.drm.message");
2a9601315dfc Revision: v2.1.22
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
    44
2a9601315dfc Revision: v2.1.22
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
    45
// A maximum length of the cipher suite description strings,
2a9601315dfc Revision: v2.1.22
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
    46
// see CipherSuiteDescription().
2a9601315dfc Revision: v2.1.22
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
    47
const TUint8 KMaxCipherSuiteDescriptionLength = 40;
2a9601315dfc Revision: v2.1.22
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
    48
2a9601315dfc Revision: v2.1.22
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
    49
const TInt KCookieBufferAllocLength = 4096;
2a9601315dfc Revision: v2.1.22
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
    50
2a9601315dfc Revision: v2.1.22
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
    51
2a9601315dfc Revision: v2.1.22
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
    52
CHttpTransactionClient::CHttpTransactionClient(HttpSessionClient& aSession, MRefHttpClientObserver* aObserver)
2a9601315dfc Revision: v2.1.22
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
    53
        :iHttpSession(aSession) , iObserver(aObserver), iReleasedData(ETrue),iClosing(EFalse)
2a9601315dfc Revision: v2.1.22
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
    54
{}
2a9601315dfc Revision: v2.1.22
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
    55
2a9601315dfc Revision: v2.1.22
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
    56
2a9601315dfc Revision: v2.1.22
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
    57
CHttpTransactionClient* CHttpTransactionClient::NewL(HttpSessionClient& aSession,
2a9601315dfc Revision: v2.1.22
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
    58
        MRefHttpClientObserver* aObserver,
2a9601315dfc Revision: v2.1.22
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
    59
        const TDesC* aUri,
2a9601315dfc Revision: v2.1.22
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
    60
        const TDesC* aRequestMethod)
2a9601315dfc Revision: v2.1.22
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
    61
{
2a9601315dfc Revision: v2.1.22
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
    62
    CHttpTransactionClient* self =  new(ELeave) CHttpTransactionClient(aSession,aObserver);
2a9601315dfc Revision: v2.1.22
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
    63
    CleanupStack::PushL(self);
2a9601315dfc Revision: v2.1.22
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
    64
    self->ConstructL(aUri, aRequestMethod);
2a9601315dfc Revision: v2.1.22
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
    65
    CleanupStack::Pop(self);
2a9601315dfc Revision: v2.1.22
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
    66
    return self;
2a9601315dfc Revision: v2.1.22
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
    67
}
2a9601315dfc Revision: v2.1.22
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
    68
2a9601315dfc Revision: v2.1.22
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
    69
void CHttpTransactionClient::ConstructL(const TDesC* aUri, const TDesC* aRequestMethod)
2a9601315dfc Revision: v2.1.22
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
    70
{
2a9601315dfc Revision: v2.1.22
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
    71
    //open the transaction
2a9601315dfc Revision: v2.1.22
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
    72
    LOG(ESOCKET,EInfo, "CHttpTransactionClient::ConstructL ");
2a9601315dfc Revision: v2.1.22
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
    73
    iFlag = 0;
2a9601315dfc Revision: v2.1.22
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
    74
    iDrmBuf = HBufC8::NewL(256);
80
d6dafc5d983f v2.2.19_1
hgs
parents: 49
diff changeset
    75
    iEndOfRequest = false;
87
1627c337e51e v2.2.21_1
hgs
parents: 80
diff changeset
    76
    iRestartedFlag = false;
21
2a9601315dfc Revision: v2.1.22
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
    77
    OpenTransactionL(aUri , aRequestMethod);
2a9601315dfc Revision: v2.1.22
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
    78
}
2a9601315dfc Revision: v2.1.22
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
    79
2a9601315dfc Revision: v2.1.22
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
    80
void CHttpTransactionClient::OpenTransactionL(const TDesC* aUri, const TDesC* aRequestMethod)
2a9601315dfc Revision: v2.1.22
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
    81
{
2a9601315dfc Revision: v2.1.22
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
    82
    LOG(ESOCKET,EInfo,"CHttpTransactionClient::OpenTransactionL + ");
2a9601315dfc Revision: v2.1.22
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
    83
    TUriParser8 uri;
2a9601315dfc Revision: v2.1.22
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
    84
    HBufC8* uriBuf= HBufC8::NewLC(aUri->Length());
2a9601315dfc Revision: v2.1.22
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
    85
    TPtr8 uriPtr = uriBuf->Des();
2a9601315dfc Revision: v2.1.22
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
    86
    uriPtr.Copy(*aUri);
2a9601315dfc Revision: v2.1.22
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
    87
    uri.Parse(*uriBuf);
2a9601315dfc Revision: v2.1.22
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
    88
    //Get Request Method String
2a9601315dfc Revision: v2.1.22
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
    89
    TBuf8<32> reqestType; //GET //POST // HEAD // Only options available in Midp 2.0 Http
2a9601315dfc Revision: v2.1.22
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
    90
2a9601315dfc Revision: v2.1.22
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
    91
    LOG(ESOCKET,EInfo,"Open TransactionL : Transaction Uri  ");
2a9601315dfc Revision: v2.1.22
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
    92
    reqestType.Copy(*aRequestMethod);
2a9601315dfc Revision: v2.1.22
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
    93
    LOG(ESOCKET,EInfo,"Open TransactionL : ReqestType ");
2a9601315dfc Revision: v2.1.22
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
    94
2a9601315dfc Revision: v2.1.22
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
    95
    RStringF requestMethoStr = iHttpSession.Session().StringPool().OpenFStringL(reqestType);
2a9601315dfc Revision: v2.1.22
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
    96
    CleanupClosePushL(requestMethoStr);
2a9601315dfc Revision: v2.1.22
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
    97
    iTransaction = iHttpSession.Session().OpenTransactionL(uri,*this,requestMethoStr);
2a9601315dfc Revision: v2.1.22
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
    98
2a9601315dfc Revision: v2.1.22
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
    99
    CleanupStack::PopAndDestroy(2);//requestMethoStr// uriBuf
2a9601315dfc Revision: v2.1.22
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
   100
    LOG(ESOCKET,EInfo,"CHttpTransactionClient::OpenTransactionL - ");
2a9601315dfc Revision: v2.1.22
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
   101
}
2a9601315dfc Revision: v2.1.22
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
   102
80
d6dafc5d983f v2.2.19_1
hgs
parents: 49
diff changeset
   103
void CHttpTransactionClient::SubmitL(RPointerArray<HBufC8>* aRawHeaders , TDesC8* aPostData, int aResponseTimeout, bool aPartialDataFlag)
21
2a9601315dfc Revision: v2.1.22
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
   104
{
2a9601315dfc Revision: v2.1.22
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
   105
    //ELOG(ESOCKET,"CHttpTransactionClient::SubmitL + ");
2a9601315dfc Revision: v2.1.22
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
   106
    //retrieve the headers
80
d6dafc5d983f v2.2.19_1
hgs
parents: 49
diff changeset
   107
    iPartialPostData = aPartialDataFlag;
21
2a9601315dfc Revision: v2.1.22
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
   108
    TInt respTimeOut = aResponseTimeout;
2a9601315dfc Revision: v2.1.22
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
   109
    delete iBuf;
2a9601315dfc Revision: v2.1.22
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
   110
    iBuf=NULL;
2a9601315dfc Revision: v2.1.22
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
   111
    if (aPostData!=NULL && aPostData->Length()>0)
2a9601315dfc Revision: v2.1.22
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
   112
    {
2a9601315dfc Revision: v2.1.22
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
   113
        HBufC8* buf = aPostData->AllocL();
2a9601315dfc Revision: v2.1.22
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
   114
        iBuf=buf;
2a9601315dfc Revision: v2.1.22
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
   115
        LOG(ESOCKET,EInfo,"SubmitL : Posting Data ");
2a9601315dfc Revision: v2.1.22
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
   116
    }
2a9601315dfc Revision: v2.1.22
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
   117
2a9601315dfc Revision: v2.1.22
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
   118
    // Disable pipelining on this transaction
2a9601315dfc Revision: v2.1.22
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
   119
    RStringPool stringPool = iHttpSession.Session().StringPool();
2a9601315dfc Revision: v2.1.22
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
   120
    RStringF property = stringPool.StringF(HTTP::EHttpPipelining, RHTTPSession::GetTable());
2a9601315dfc Revision: v2.1.22
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
   121
    THTTPHdrVal disablePipelining = stringPool.StringF(HTTP::EDisablePipelining, RHTTPSession::GetTable());
2a9601315dfc Revision: v2.1.22
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
   122
    iTransaction.PropertySet().SetPropertyL(property, disablePipelining);
2a9601315dfc Revision: v2.1.22
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
   123
2a9601315dfc Revision: v2.1.22
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
   124
    if (respTimeOut != -1)
2a9601315dfc Revision: v2.1.22
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
   125
    {
2a9601315dfc Revision: v2.1.22
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
   126
        LOG1(ESOCKET,EInfo,"Setting response timeout to http stack with value = %d ",aResponseTimeout);
2a9601315dfc Revision: v2.1.22
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
   127
        property = stringPool.StringF(HTTP::EReceiveTimeOutValue, RHTTPSession::GetTable());
2a9601315dfc Revision: v2.1.22
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
   128
        THTTPHdrVal responseTimeout(respTimeOut);
2a9601315dfc Revision: v2.1.22
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
   129
        iTransaction.PropertySet().SetPropertyL(property, responseTimeout);
2a9601315dfc Revision: v2.1.22
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
   130
    }
2a9601315dfc Revision: v2.1.22
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
   131
2a9601315dfc Revision: v2.1.22
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
   132
    //Submit the transaction
87
1627c337e51e v2.2.21_1
hgs
parents: 80
diff changeset
   133
    if (!iRestartedFlag)
21
2a9601315dfc Revision: v2.1.22
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
   134
    {
87
1627c337e51e v2.2.21_1
hgs
parents: 80
diff changeset
   135
        RHTTPHeaders hdr = iTransaction.Request().GetHeaderCollection();
1627c337e51e v2.2.21_1
hgs
parents: 80
diff changeset
   136
        TInt headerCount = aRawHeaders->Count();
1627c337e51e v2.2.21_1
hgs
parents: 80
diff changeset
   137
        for (TInt ii=0; ii < headerCount; ++ii)
1627c337e51e v2.2.21_1
hgs
parents: 80
diff changeset
   138
        {
1627c337e51e v2.2.21_1
hgs
parents: 80
diff changeset
   139
            SetHeaderL(hdr, (*aRawHeaders)[ii]);
1627c337e51e v2.2.21_1
hgs
parents: 80
diff changeset
   140
        }
21
2a9601315dfc Revision: v2.1.22
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
   141
    }
2a9601315dfc Revision: v2.1.22
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
   142
2a9601315dfc Revision: v2.1.22
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
   143
    //iHttpSession.CustomiseHeadersL(hdr);
2a9601315dfc Revision: v2.1.22
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
   144
2a9601315dfc Revision: v2.1.22
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
   145
    //Set Data
2a9601315dfc Revision: v2.1.22
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
   146
    if (iBuf && iBuf->Length() > KErrNone)
2a9601315dfc Revision: v2.1.22
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
   147
        iTransaction.Request().SetBody(*this);
2a9601315dfc Revision: v2.1.22
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
   148
    /* The data will be requested from MHttpDataSupplier*/
2a9601315dfc Revision: v2.1.22
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
   149
    iJavaWaitingOnCallBack=ETrue;
2a9601315dfc Revision: v2.1.22
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
   150
    iJavaWaitingOnReadCallBack=ETrue; // Assume somebody opened an input Stream
2a9601315dfc Revision: v2.1.22
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
   151
    LOG1(ESOCKET,EInfo,"CHttpTransactionClient::SubmitL :iTransaction.Id %d ",iTransaction.Id());
2a9601315dfc Revision: v2.1.22
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
   152
    TRAP_IGNORE(iTransaction.SubmitL());
2a9601315dfc Revision: v2.1.22
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
   153
    LOG(ESOCKET,EInfo,"CHttpTransactionClient::SubmitL - ");
2a9601315dfc Revision: v2.1.22
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
   154
}
2a9601315dfc Revision: v2.1.22
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
   155
2a9601315dfc Revision: v2.1.22
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
   156
2a9601315dfc Revision: v2.1.22
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
   157
void CHttpTransactionClient::SetHeaderL(RHTTPHeaders& aHeaders, const TDesC8* aRawField)
2a9601315dfc Revision: v2.1.22
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
   158
{
2a9601315dfc Revision: v2.1.22
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
   159
    /*Raw Headers are passed in from java of the format
2a9601315dfc Revision: v2.1.22
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
   160
    * ValueKey ;; property
2a9601315dfc Revision: v2.1.22
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
   161
    * HTTP requires all request properties which can legally have
2a9601315dfc Revision: v2.1.22
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
   162
    * multiple instances with the same key to use a comma-separated list
2a9601315dfc Revision: v2.1.22
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
   163
    * syntax which enables multiple properties to be appended into a
2a9601315dfc Revision: v2.1.22
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
   164
    * single property.
2a9601315dfc Revision: v2.1.22
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
   165
    */
2a9601315dfc Revision: v2.1.22
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
   166
    //Find the value field
2a9601315dfc Revision: v2.1.22
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
   167
    //Seperated from values in Java by KSeperator
2a9601315dfc Revision: v2.1.22
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
   168
    TInt valueIndex = aRawField->Find(KSeperator);
2a9601315dfc Revision: v2.1.22
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
   169
    User::LeaveIfError(valueIndex);
2a9601315dfc Revision: v2.1.22
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
   170
    TPtrC8 value =aRawField->Left(valueIndex);
2a9601315dfc Revision: v2.1.22
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
   171
    RStringF valueF = iHttpSession.Session().StringPool().OpenFStringL(value);
2a9601315dfc Revision: v2.1.22
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
   172
    CleanupClosePushL(valueF);
2a9601315dfc Revision: v2.1.22
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
   173
    TPtrC8 propertyRaw= aRawField->Mid(valueIndex+2);
2a9601315dfc Revision: v2.1.22
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
   174
    LOG(ESOCKET,EInfo,"CHttpTransactionClient Add header value ");
2a9601315dfc Revision: v2.1.22
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
   175
    aHeaders.SetRawFieldL(valueF, propertyRaw , KComma);
2a9601315dfc Revision: v2.1.22
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
   176
    CleanupStack::PopAndDestroy();//valueF
2a9601315dfc Revision: v2.1.22
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
   177
}
2a9601315dfc Revision: v2.1.22
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
   178
2a9601315dfc Revision: v2.1.22
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
   179
void CHttpTransactionClient::GetResponseL(RPointerArray<HBufC8>* aRawHeaders)
2a9601315dfc Revision: v2.1.22
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
   180
{
2a9601315dfc Revision: v2.1.22
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
   181
    LOG(ESOCKET,EInfo,"CHttpTransactionClient::GetResponseL(RPointerArray<HBufC8>* aRawHeaders)");
2a9601315dfc Revision: v2.1.22
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
   182
    RStringPool strP = iTransaction.Session().StringPool();
2a9601315dfc Revision: v2.1.22
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
   183
    //First element in response array is the status line of the form
2a9601315dfc Revision: v2.1.22
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
   184
    //HTTP-Version (major.minor) ;; Status-Code ;; Reason-Phrase
2a9601315dfc Revision: v2.1.22
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
   185
    LOG1(ESOCKET,EInfo,"CHttpTransactionClient::GetResponseL :iTransaction.Id %d ",iTransaction.Id());
2a9601315dfc Revision: v2.1.22
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
   186
    RHTTPResponse response = iTransaction.Response();
2a9601315dfc Revision: v2.1.22
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
   187
2a9601315dfc Revision: v2.1.22
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
   188
    TInt statusLineLength=0;
2a9601315dfc Revision: v2.1.22
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
   189
2a9601315dfc Revision: v2.1.22
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
   190
    //HTTP-Version
2a9601315dfc Revision: v2.1.22
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
   191
    TVersion serverVersion = response.Version();
2a9601315dfc Revision: v2.1.22
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
   192
    TBuf<16> major;
2a9601315dfc Revision: v2.1.22
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
   193
    major.Num(serverVersion.iMajor);
2a9601315dfc Revision: v2.1.22
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
   194
    TBuf<16> minor;
2a9601315dfc Revision: v2.1.22
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
   195
    minor.Num(serverVersion.iMinor);
2a9601315dfc Revision: v2.1.22
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
   196
    statusLineLength+=major.Length();
2a9601315dfc Revision: v2.1.22
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
   197
    statusLineLength+=1;//KDot
2a9601315dfc Revision: v2.1.22
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
   198
    statusLineLength+=minor.Length();
2a9601315dfc Revision: v2.1.22
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
   199
2a9601315dfc Revision: v2.1.22
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
   200
    //Status code
2a9601315dfc Revision: v2.1.22
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
   201
    TBuf<16> stausCode;
2a9601315dfc Revision: v2.1.22
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
   202
    TInt serverStatusCode = response.StatusCode();
2a9601315dfc Revision: v2.1.22
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
   203
    stausCode.Num(serverStatusCode);
2a9601315dfc Revision: v2.1.22
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
   204
    statusLineLength+=stausCode.Length();
2a9601315dfc Revision: v2.1.22
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
   205
2a9601315dfc Revision: v2.1.22
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
   206
    //Status Text
2a9601315dfc Revision: v2.1.22
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
   207
    RStringF serverResponseTextF = response.StatusText();
2a9601315dfc Revision: v2.1.22
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
   208
    statusLineLength+= serverResponseTextF.DesC().Length();
2a9601315dfc Revision: v2.1.22
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
   209
2a9601315dfc Revision: v2.1.22
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
   210
    //Sepearators KSeperator *2
2a9601315dfc Revision: v2.1.22
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
   211
    statusLineLength+=4;//
2a9601315dfc Revision: v2.1.22
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
   212
2a9601315dfc Revision: v2.1.22
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
   213
    HBufC8* responseText = HBufC8::NewLC(statusLineLength);
2a9601315dfc Revision: v2.1.22
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
   214
    //Create Status Line
2a9601315dfc Revision: v2.1.22
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
   215
    //Version
2a9601315dfc Revision: v2.1.22
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
   216
    responseText->Des().Append(major);
2a9601315dfc Revision: v2.1.22
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
   217
    responseText->Des().Append(KDot);
2a9601315dfc Revision: v2.1.22
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
   218
    responseText->Des().Append(minor);
2a9601315dfc Revision: v2.1.22
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
   219
    //Status Code
2a9601315dfc Revision: v2.1.22
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
   220
    responseText->Des().Append(KSeperator);
2a9601315dfc Revision: v2.1.22
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
   221
    responseText->Des().Append(stausCode);
2a9601315dfc Revision: v2.1.22
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
   222
    //Status Text
2a9601315dfc Revision: v2.1.22
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
   223
    responseText->Des().Append(KSeperator);
2a9601315dfc Revision: v2.1.22
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
   224
    responseText->Des().Append(serverResponseTextF.DesC());
2a9601315dfc Revision: v2.1.22
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
   225
    aRawHeaders->Append(responseText);
2a9601315dfc Revision: v2.1.22
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
   226
    CleanupStack::Pop(responseText);
2a9601315dfc Revision: v2.1.22
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
   227
2a9601315dfc Revision: v2.1.22
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
   228
    //Package up all the transaction headers in to an array of java strings
2a9601315dfc Revision: v2.1.22
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
   229
    RHTTPHeaders headers =response.GetHeaderCollection();
2a9601315dfc Revision: v2.1.22
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
   230
    THTTPHdrFieldIter it = headers.Fields();
2a9601315dfc Revision: v2.1.22
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
   231
    RStringTokenF token;
2a9601315dfc Revision: v2.1.22
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
   232
    RStringF fieldNameStr;
2a9601315dfc Revision: v2.1.22
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
   233
    TPtrC8 rawFldPtr;
2a9601315dfc Revision: v2.1.22
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
   234
    HBufC8* rawHeader = NULL; // field name  and values
2a9601315dfc Revision: v2.1.22
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
   235
    TInt rawFieldLength=0;
2a9601315dfc Revision: v2.1.22
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
   236
    do
2a9601315dfc Revision: v2.1.22
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
   237
    {
2a9601315dfc Revision: v2.1.22
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
   238
        token = it();
2a9601315dfc Revision: v2.1.22
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
   239
        fieldNameStr=strP.StringF(token);
2a9601315dfc Revision: v2.1.22
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
   240
        //Get the field data assume we get comma seperated values and
2a9601315dfc Revision: v2.1.22
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
   241
        //don't have to use aPartIdx
2a9601315dfc Revision: v2.1.22
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
   242
2a9601315dfc Revision: v2.1.22
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
   243
        RStringF setCookie = strP.StringF(HTTP::ESetCookie,RHTTPSession::GetTable());
2a9601315dfc Revision: v2.1.22
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
   244
        if (fieldNameStr == setCookie)
2a9601315dfc Revision: v2.1.22
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
   245
        {
2a9601315dfc Revision: v2.1.22
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
   246
            // Buffer for storing a single cookie
2a9601315dfc Revision: v2.1.22
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
   247
            HBufC8* cookieBuf = HBufC8::NewLC(KCookieBufferAllocLength);
2a9601315dfc Revision: v2.1.22
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
   248
2a9601315dfc Revision: v2.1.22
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
   249
            cookieBuf->Des().Append(fieldNameStr.DesC());
2a9601315dfc Revision: v2.1.22
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
   250
            cookieBuf->Des().Append(KSeperator);
2a9601315dfc Revision: v2.1.22
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
   251
            iMinLength = cookieBuf->Des().Length();
2a9601315dfc Revision: v2.1.22
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
   252
2a9601315dfc Revision: v2.1.22
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
   253
            TInt totalCookiesLength = 0;
2a9601315dfc Revision: v2.1.22
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
   254
            TInt cookieCount = headers.FieldPartsL(setCookie);
2a9601315dfc Revision: v2.1.22
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
   255
2a9601315dfc Revision: v2.1.22
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
   256
            if (cookieCount != 0)
2a9601315dfc Revision: v2.1.22
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
   257
            {
2a9601315dfc Revision: v2.1.22
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
   258
                for (TInt ii = 0; ii < cookieCount; ii++)
2a9601315dfc Revision: v2.1.22
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
   259
                {
2a9601315dfc Revision: v2.1.22
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
   260
                    iDiscardCookie = false;
2a9601315dfc Revision: v2.1.22
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
   261
                    StoreOneCookieL(cookieBuf, headers, ii, setCookie);
2a9601315dfc Revision: v2.1.22
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
   262
                    if (ii < cookieCount-1)
2a9601315dfc Revision: v2.1.22
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
   263
                    {
2a9601315dfc Revision: v2.1.22
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
   264
                        // Replace last semicolon with comma
2a9601315dfc Revision: v2.1.22
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
   265
                        if (iDiscardCookie!=true)
2a9601315dfc Revision: v2.1.22
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
   266
                        {
2a9601315dfc Revision: v2.1.22
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
   267
                            cookieBuf->Des().SetLength(cookieBuf->Des().Length() - KSemiColonSpace().Length());
2a9601315dfc Revision: v2.1.22
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
   268
                            cookieBuf->Des().Append(KCommaSpace);
2a9601315dfc Revision: v2.1.22
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
   269
                        }
2a9601315dfc Revision: v2.1.22
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
   270
                        else
2a9601315dfc Revision: v2.1.22
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
   271
                        {
2a9601315dfc Revision: v2.1.22
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
   272
                            cookieBuf->Des().Append(KCommaSpace);
2a9601315dfc Revision: v2.1.22
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
   273
                        }
2a9601315dfc Revision: v2.1.22
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
   274
                    }
2a9601315dfc Revision: v2.1.22
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
   275
2a9601315dfc Revision: v2.1.22
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
   276
                    if (ii > 0)
2a9601315dfc Revision: v2.1.22
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
   277
                    {
2a9601315dfc Revision: v2.1.22
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
   278
                        totalCookiesLength += cookieBuf->Des().Length();
2a9601315dfc Revision: v2.1.22
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
   279
                        rawHeader = rawHeader->ReAllocL(totalCookiesLength);
2a9601315dfc Revision: v2.1.22
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
   280
                        rawHeader->Des().Append(*cookieBuf);
2a9601315dfc Revision: v2.1.22
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
   281
                    }
2a9601315dfc Revision: v2.1.22
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
   282
                    else
2a9601315dfc Revision: v2.1.22
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
   283
                    {
2a9601315dfc Revision: v2.1.22
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
   284
                        rawHeader = cookieBuf->AllocL();
2a9601315dfc Revision: v2.1.22
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
   285
                        totalCookiesLength = rawHeader->Length();
2a9601315dfc Revision: v2.1.22
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
   286
                    }
2a9601315dfc Revision: v2.1.22
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
   287
2a9601315dfc Revision: v2.1.22
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
   288
                    cookieBuf->Des().Zero();
2a9601315dfc Revision: v2.1.22
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
   289
                }
2a9601315dfc Revision: v2.1.22
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
   290
            }
2a9601315dfc Revision: v2.1.22
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
   291
            else
2a9601315dfc Revision: v2.1.22
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
   292
            {
2a9601315dfc Revision: v2.1.22
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
   293
                LOG(ESOCKET,EInfo,"CHttpTransactionClient::GetResponseL 'Set-Cookie:' header field is empty");
2a9601315dfc Revision: v2.1.22
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
   294
                rawHeader = cookieBuf->AllocL();
2a9601315dfc Revision: v2.1.22
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
   295
            }
2a9601315dfc Revision: v2.1.22
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
   296
2a9601315dfc Revision: v2.1.22
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
   297
            CleanupStack::PopAndDestroy(cookieBuf);
2a9601315dfc Revision: v2.1.22
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
   298
            aRawHeaders->Append(rawHeader);
2a9601315dfc Revision: v2.1.22
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
   299
        }
2a9601315dfc Revision: v2.1.22
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
   300
        else
2a9601315dfc Revision: v2.1.22
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
   301
        {
2a9601315dfc Revision: v2.1.22
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
   302
            TInt err = headers.GetRawField(fieldNameStr,rawFldPtr);
2a9601315dfc Revision: v2.1.22
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
   303
2a9601315dfc Revision: v2.1.22
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
   304
            if (err==KErrNone)
2a9601315dfc Revision: v2.1.22
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
   305
            {
2a9601315dfc Revision: v2.1.22
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
   306
                rawFieldLength += fieldNameStr.DesC().Length();
2a9601315dfc Revision: v2.1.22
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
   307
                rawFieldLength += 2;//KSeperator Length;
2a9601315dfc Revision: v2.1.22
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
   308
                rawFieldLength += rawFldPtr.Length();
2a9601315dfc Revision: v2.1.22
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
   309
                rawHeader = HBufC8::NewL(rawFieldLength);
2a9601315dfc Revision: v2.1.22
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
   310
                rawHeader->Des().Append(fieldNameStr.DesC());
2a9601315dfc Revision: v2.1.22
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
   311
                rawHeader->Des().Append(KSeperator);
2a9601315dfc Revision: v2.1.22
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
   312
                rawHeader->Des().Append(rawFldPtr);
2a9601315dfc Revision: v2.1.22
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
   313
                aRawHeaders->Append(rawHeader);
2a9601315dfc Revision: v2.1.22
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
   314
                rawFieldLength=0;
2a9601315dfc Revision: v2.1.22
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
   315
            }
2a9601315dfc Revision: v2.1.22
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
   316
        }
2a9601315dfc Revision: v2.1.22
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
   317
        ++it;
2a9601315dfc Revision: v2.1.22
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
   318
    }
2a9601315dfc Revision: v2.1.22
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
   319
    while (!it.AtEnd());
2a9601315dfc Revision: v2.1.22
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
   320
}
2a9601315dfc Revision: v2.1.22
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
   321
23
98ccebc37403 Revision: v2.1.24
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents: 21
diff changeset
   322
21
2a9601315dfc Revision: v2.1.22
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
   323
/*
2a9601315dfc Revision: v2.1.22
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
   324
* Returns the total number of bytes read into the buffer,
2a9601315dfc Revision: v2.1.22
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
   325
* or -1 if there is no more data because the end of the stream
2a9601315dfc Revision: v2.1.22
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
   326
* has been reached.
2a9601315dfc Revision: v2.1.22
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
   327
*/
2a9601315dfc Revision: v2.1.22
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
   328
TInt CHttpTransactionClient::ReadBytes(TDes8& aBytesPtr)
2a9601315dfc Revision: v2.1.22
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
   329
{
2a9601315dfc Revision: v2.1.22
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
   330
    LOG(ESOCKET,EInfo,"CHttpTransactionClient:: ReadBytes");
2a9601315dfc Revision: v2.1.22
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
   331
    TInt maxBufLength = aBytesPtr.MaxLength();
2a9601315dfc Revision: v2.1.22
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
   332
    TInt bodyDataPartLength = 0;
2a9601315dfc Revision: v2.1.22
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
   333
    if (iDrmDownload == false)
2a9601315dfc Revision: v2.1.22
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
   334
    {
2a9601315dfc Revision: v2.1.22
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
   335
        bodyDataPartLength = iBuf->Length();
2a9601315dfc Revision: v2.1.22
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
   336
    }
2a9601315dfc Revision: v2.1.22
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
   337
    else
2a9601315dfc Revision: v2.1.22
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
   338
    {
2a9601315dfc Revision: v2.1.22
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
   339
        bodyDataPartLength = iDrmBuf->Length();
2a9601315dfc Revision: v2.1.22
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
   340
    }
2a9601315dfc Revision: v2.1.22
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
   341
    LOG1(ESOCKET,EInfo,"CHttpTransactionClient::ReadBytes: maxRead: %d," , maxBufLength);
2a9601315dfc Revision: v2.1.22
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
   342
    LOG1(ESOCKET,EInfo,"CHttpTransactionClient::ReadBytes: bodyDataPartLength:: %d " ,bodyDataPartLength);
2a9601315dfc Revision: v2.1.22
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
   343
    TInt bytesRead = (maxBufLength+iJavaReadOffset > bodyDataPartLength) ? (bodyDataPartLength - iJavaReadOffset) : maxBufLength;
2a9601315dfc Revision: v2.1.22
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
   344
    if (bytesRead>0)
2a9601315dfc Revision: v2.1.22
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
   345
    {
2a9601315dfc Revision: v2.1.22
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
   346
        LOG1(ESOCKET,EInfo,"Bytes read : %d " ,bytesRead);
2a9601315dfc Revision: v2.1.22
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
   347
2a9601315dfc Revision: v2.1.22
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
   348
        if (iDrmDownload == false)
2a9601315dfc Revision: v2.1.22
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
   349
        {
2a9601315dfc Revision: v2.1.22
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
   350
            TPtrC8 bufPtr = iBuf->Mid(iJavaReadOffset,bytesRead);
2a9601315dfc Revision: v2.1.22
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
   351
            aBytesPtr.Copy(bufPtr);
2a9601315dfc Revision: v2.1.22
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
   352
        }
2a9601315dfc Revision: v2.1.22
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
   353
        else
2a9601315dfc Revision: v2.1.22
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
   354
        {
2a9601315dfc Revision: v2.1.22
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
   355
            TPtrC8 bufPtr = iDrmBuf->Mid(iJavaReadOffset,bytesRead);
2a9601315dfc Revision: v2.1.22
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
   356
            aBytesPtr.Copy(bufPtr);
2a9601315dfc Revision: v2.1.22
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
   357
        }
2a9601315dfc Revision: v2.1.22
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
   358
2a9601315dfc Revision: v2.1.22
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
   359
        LOG1(ESOCKET,EInfo,"CHttpTransactionClient::ReadBytes: iJavaReadOffset:: %d " ,iJavaReadOffset);
2a9601315dfc Revision: v2.1.22
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
   360
        if (iDrmDownload == false)
2a9601315dfc Revision: v2.1.22
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
   361
        {
2a9601315dfc Revision: v2.1.22
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
   362
            if ((iJavaReadOffset+bytesRead) == bodyDataPartLength && iLastChunk)
2a9601315dfc Revision: v2.1.22
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
   363
            {
2a9601315dfc Revision: v2.1.22
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
   364
                //All body data from the http transaction has been read
2a9601315dfc Revision: v2.1.22
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
   365
                LOG(ESOCKET,EInfo,"CHttpTransactionClient::ReadBytes: EOF iLastChunk");
2a9601315dfc Revision: v2.1.22
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
   366
                iRead = ETrue;
2a9601315dfc Revision: v2.1.22
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
   367
2a9601315dfc Revision: v2.1.22
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
   368
                iJavaWaitingOnReadCallBack=EFalse;
2a9601315dfc Revision: v2.1.22
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
   369
                TRAP_IGNORE(iObserver->DataReadyForRead(-1));
2a9601315dfc Revision: v2.1.22
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
   370
            }
2a9601315dfc Revision: v2.1.22
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
   371
        }
2a9601315dfc Revision: v2.1.22
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
   372
        else
2a9601315dfc Revision: v2.1.22
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
   373
        {
2a9601315dfc Revision: v2.1.22
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
   374
            if ((iJavaReadOffset+bytesRead) == iDrmBuf->Length() && iLastChunk)
2a9601315dfc Revision: v2.1.22
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
   375
            {
2a9601315dfc Revision: v2.1.22
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
   376
                //All DRM body data from the http transaction has been read
2a9601315dfc Revision: v2.1.22
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
   377
                LOG(ESOCKET,EInfo,"CHttpTransactionClient::ReadBytes: EOF iLastChunk");
2a9601315dfc Revision: v2.1.22
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
   378
                iRead = ETrue;
2a9601315dfc Revision: v2.1.22
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
   379
2a9601315dfc Revision: v2.1.22
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
   380
                iJavaWaitingOnReadCallBack=EFalse;
2a9601315dfc Revision: v2.1.22
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
   381
                TRAP_IGNORE(iObserver->DataReadyForRead(-1));
2a9601315dfc Revision: v2.1.22
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
   382
            }
2a9601315dfc Revision: v2.1.22
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
   383
        }
2a9601315dfc Revision: v2.1.22
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
   384
    } // if(bytesread > 0)
2a9601315dfc Revision: v2.1.22
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
   385
    if ((iJavaReadOffset+bytesRead)<=bodyDataPartLength)
2a9601315dfc Revision: v2.1.22
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
   386
    {
2a9601315dfc Revision: v2.1.22
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
   387
2a9601315dfc Revision: v2.1.22
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
   388
        if (iJavaReadOffset+bytesRead < bodyDataPartLength)
2a9601315dfc Revision: v2.1.22
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
   389
        {
2a9601315dfc Revision: v2.1.22
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
   390
            //Java hasn't read all the current body data buffer, inform java
2a9601315dfc Revision: v2.1.22
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
   391
            //amount of bytes left to read in buffer.
2a9601315dfc Revision: v2.1.22
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
   392
2a9601315dfc Revision: v2.1.22
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
   393
            iJavaReadOffset+=bytesRead;
2a9601315dfc Revision: v2.1.22
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
   394
            TInt  bytesLeftInBuffer = bodyDataPartLength-iJavaReadOffset;
2a9601315dfc Revision: v2.1.22
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
   395
            LOG1(ESOCKET,EInfo," CHttpTransactionClient::ReadBytes: bytesLeftInBuffer: %d",bytesLeftInBuffer);
2a9601315dfc Revision: v2.1.22
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
   396
            //Unblock java so it can read the remaining buffered data
2a9601315dfc Revision: v2.1.22
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
   397
            iJavaWaitingOnReadCallBack=ETrue;
2a9601315dfc Revision: v2.1.22
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
   398
            TRAP_IGNORE(iObserver->DataReadyForRead(bytesLeftInBuffer));
2a9601315dfc Revision: v2.1.22
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
   399
        }
2a9601315dfc Revision: v2.1.22
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
   400
        else
2a9601315dfc Revision: v2.1.22
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
   401
        {
2a9601315dfc Revision: v2.1.22
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
   402
            // in this call, the iBuf data was completely read, so call release data to get the next chunk(part) of body from
2a9601315dfc Revision: v2.1.22
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
   403
            // the native stack
2a9601315dfc Revision: v2.1.22
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
   404
2a9601315dfc Revision: v2.1.22
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
   405
            if (iDrmDownload == false)
2a9601315dfc Revision: v2.1.22
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
   406
            {
2a9601315dfc Revision: v2.1.22
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
   407
                // Non-Drm case, offset is reset to 0, starting reading newly from iBuf from the next call
2a9601315dfc Revision: v2.1.22
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
   408
                iJavaReadOffset=0;
2a9601315dfc Revision: v2.1.22
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
   409
                LOG(ESOCKET,EInfo,"CHttpTransactionClient:: ReadBytes ReleaseData!");
2a9601315dfc Revision: v2.1.22
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
   410
                iReleasedData=ETrue;
2a9601315dfc Revision: v2.1.22
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
   411
                if (iBuf)
2a9601315dfc Revision: v2.1.22
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
   412
                {
2a9601315dfc Revision: v2.1.22
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
   413
                    delete iBuf;
2a9601315dfc Revision: v2.1.22
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
   414
                    iBuf = NULL;
2a9601315dfc Revision: v2.1.22
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
   415
                }
2a9601315dfc Revision: v2.1.22
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
   416
                iRespBody->ReleaseData();   // tell the stack to send the next response body data, stack will call mhfrunl after this
2a9601315dfc Revision: v2.1.22
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
   417
            }
2a9601315dfc Revision: v2.1.22
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
   418
            else
2a9601315dfc Revision: v2.1.22
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
   419
            {
2a9601315dfc Revision: v2.1.22
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
   420
                // DRM file download, index is never reset to 0 , continue reading from drm buffer
2a9601315dfc Revision: v2.1.22
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
   421
                iJavaReadOffset+=bytesRead;
2a9601315dfc Revision: v2.1.22
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
   422
2a9601315dfc Revision: v2.1.22
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
   423
            }
2a9601315dfc Revision: v2.1.22
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
   424
2a9601315dfc Revision: v2.1.22
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
   425
        }
2a9601315dfc Revision: v2.1.22
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
   426
2a9601315dfc Revision: v2.1.22
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
   427
    }
2a9601315dfc Revision: v2.1.22
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
   428
2a9601315dfc Revision: v2.1.22
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
   429
    LOG1(ESOCKET,EInfo,"CHttpTransactionClient::ReadBytes: return bytesRead %d " , bytesRead);
2a9601315dfc Revision: v2.1.22
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
   430
    return bytesRead;
2a9601315dfc Revision: v2.1.22
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
   431
}
2a9601315dfc Revision: v2.1.22
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
   432
2a9601315dfc Revision: v2.1.22
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
   433
2a9601315dfc Revision: v2.1.22
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
   434
2a9601315dfc Revision: v2.1.22
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
   435
void CHttpTransactionClient::MHFRunL(RHTTPTransaction aTransaction, const THTTPEvent& aEvent)
2a9601315dfc Revision: v2.1.22
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
   436
{
2a9601315dfc Revision: v2.1.22
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
   437
    LOG(ESOCKET,EInfo,"CHttpTransactionClient::MHFRunL +");
2a9601315dfc Revision: v2.1.22
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
   438
2a9601315dfc Revision: v2.1.22
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
   439
    if (iTransaction== aTransaction)
2a9601315dfc Revision: v2.1.22
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
   440
    {
2a9601315dfc Revision: v2.1.22
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
   441
        LOG1(ESOCKET,EInfo,"before switch aEvent.iStatus = %d ",aEvent.iStatus);
2a9601315dfc Revision: v2.1.22
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
   442
        switch (aEvent.iStatus)
2a9601315dfc Revision: v2.1.22
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
   443
        {
2a9601315dfc Revision: v2.1.22
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
   444
        case THTTPEvent::ESubmit:
2a9601315dfc Revision: v2.1.22
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
   445
            LOG1(ESOCKET,EInfo,"MHFRunL::ESubmit : aEvent.iStatus = %d",aEvent.iStatus);
2a9601315dfc Revision: v2.1.22
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
   446
            iStatus= CHttpTransactionClient::ESubmitted;
2a9601315dfc Revision: v2.1.22
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
   447
            //Only send an event to Java when we've got a response
2a9601315dfc Revision: v2.1.22
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
   448
            break;
2a9601315dfc Revision: v2.1.22
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
   449
        case THTTPEvent::ECancel:
2a9601315dfc Revision: v2.1.22
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
   450
            LOG(ESOCKET,EInfo,"MHFRunL::ECancel");
2a9601315dfc Revision: v2.1.22
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
   451
            iStatus =CHttpTransactionClient:: ECancelled;
2a9601315dfc Revision: v2.1.22
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
   452
            if (iJavaWaitingOnCallBack)
2a9601315dfc Revision: v2.1.22
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
   453
            {
2a9601315dfc Revision: v2.1.22
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
   454
                iObserver->SubmitComplete(iStatus);
2a9601315dfc Revision: v2.1.22
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
   455
                LOG(ESOCKET,EInfo,"CHttpTransactionClient::MHFRunL ECancel ");
2a9601315dfc Revision: v2.1.22
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
   456
                iJavaWaitingOnCallBack=EFalse;
2a9601315dfc Revision: v2.1.22
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
   457
            }
2a9601315dfc Revision: v2.1.22
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
   458
2a9601315dfc Revision: v2.1.22
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
   459
            if (iJavaWaitingOnReadCallBack)
2a9601315dfc Revision: v2.1.22
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
   460
            {
2a9601315dfc Revision: v2.1.22
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
   461
                LOG(ESOCKET,EInfo,"Notifiy Read EOF / Cancel");
2a9601315dfc Revision: v2.1.22
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
   462
                iJavaWaitingOnCallBack=EFalse;
2a9601315dfc Revision: v2.1.22
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
   463
                iObserver->DataReadyForRead(-1);
2a9601315dfc Revision: v2.1.22
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
   464
            }
2a9601315dfc Revision: v2.1.22
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
   465
2a9601315dfc Revision: v2.1.22
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
   466
            break;
2a9601315dfc Revision: v2.1.22
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
   467
        case THTTPEvent::EClosed:
2a9601315dfc Revision: v2.1.22
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
   468
            LOG(ESOCKET,EInfo,"MHFRunL::EClosed");
2a9601315dfc Revision: v2.1.22
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
   469
            iStatus = CHttpTransactionClient::EClosed;
2a9601315dfc Revision: v2.1.22
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
   470
            if (iJavaWaitingOnCallBack)
2a9601315dfc Revision: v2.1.22
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
   471
            {
2a9601315dfc Revision: v2.1.22
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
   472
                iJavaWaitingOnCallBack=EFalse;
2a9601315dfc Revision: v2.1.22
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
   473
                LOG(ESOCKET,EInfo,"CHttpTransactionClient::MHFRunL EClosed");
2a9601315dfc Revision: v2.1.22
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
   474
                iObserver->SubmitComplete(iStatus);
2a9601315dfc Revision: v2.1.22
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
   475
            }
2a9601315dfc Revision: v2.1.22
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
   476
            if (iJavaWaitingOnReadCallBack)
2a9601315dfc Revision: v2.1.22
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
   477
            {
2a9601315dfc Revision: v2.1.22
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
   478
                LOG(ESOCKET,EInfo,"Notifiy Read EOF / Cancel");
2a9601315dfc Revision: v2.1.22
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
   479
                iJavaWaitingOnCallBack=EFalse;
2a9601315dfc Revision: v2.1.22
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
   480
                iObserver->DataReadyForRead(-1);
2a9601315dfc Revision: v2.1.22
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
   481
            }
2a9601315dfc Revision: v2.1.22
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
   482
2a9601315dfc Revision: v2.1.22
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
   483
            break;
2a9601315dfc Revision: v2.1.22
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
   484
            /*Receiving transaction events*/
2a9601315dfc Revision: v2.1.22
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
   485
        case THTTPEvent::EGotResponseTrailerHeaders:
2a9601315dfc Revision: v2.1.22
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
   486
        {
2a9601315dfc Revision: v2.1.22
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
   487
            LOG(ESOCKET,EInfo,"MHFRunL  EGotResponseTrailerHeaders");
2a9601315dfc Revision: v2.1.22
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
   488
            iStatus= CHttpTransactionClient::EGotResponse;
2a9601315dfc Revision: v2.1.22
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
   489
            break;
2a9601315dfc Revision: v2.1.22
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
   490
        }
2a9601315dfc Revision: v2.1.22
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
   491
        case THTTPEvent::ESucceeded:
2a9601315dfc Revision: v2.1.22
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
   492
        {
2a9601315dfc Revision: v2.1.22
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
   493
            LOG(ESOCKET,EInfo,"MHFRunL ESucceeded");
2a9601315dfc Revision: v2.1.22
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
   494
            break;
2a9601315dfc Revision: v2.1.22
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
   495
        }
2a9601315dfc Revision: v2.1.22
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
   496
        case THTTPEvent::EGotResponseHeaders:
2a9601315dfc Revision: v2.1.22
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
   497
        {
2a9601315dfc Revision: v2.1.22
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
   498
            LOG(ESOCKET,EInfo,"MHFRunL EGotResponseHeaders");
2a9601315dfc Revision: v2.1.22
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
   499
            iStatus = CHttpTransactionClient::EGotResponse;
2a9601315dfc Revision: v2.1.22
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
   500
            //If  we are secure attempt to get the security information.
2a9601315dfc Revision: v2.1.22
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
   501
            //At the moment the native HTTP stack only allows us to retrieve
2a9601315dfc Revision: v2.1.22
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
   502
            //Server cert info after and a submission and before the transaction is
2a9601315dfc Revision: v2.1.22
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
   503
            //complete, ignore any warnings as we may not be in sercure mode
2a9601315dfc Revision: v2.1.22
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
   504
2a9601315dfc Revision: v2.1.22
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
   505
            RStringPool strP = iTransaction.Session().StringPool();
2a9601315dfc Revision: v2.1.22
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
   506
            RHTTPResponse response = iTransaction.Response();
2a9601315dfc Revision: v2.1.22
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
   507
            RHTTPHeaders headers =response.GetHeaderCollection();
2a9601315dfc Revision: v2.1.22
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
   508
            THTTPHdrFieldIter it = headers.Fields();
2a9601315dfc Revision: v2.1.22
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
   509
            RStringTokenF token;
2a9601315dfc Revision: v2.1.22
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
   510
            RStringF fieldNameStr;
2a9601315dfc Revision: v2.1.22
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
   511
            TPtrC8 rawFldPtr;
2a9601315dfc Revision: v2.1.22
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
   512
            do
2a9601315dfc Revision: v2.1.22
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
   513
            {
2a9601315dfc Revision: v2.1.22
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
   514
                token = it();
2a9601315dfc Revision: v2.1.22
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
   515
                fieldNameStr=strP.StringF(token);
2a9601315dfc Revision: v2.1.22
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
   516
                // Work around for DRM download
2a9601315dfc Revision: v2.1.22
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
   517
                RStringF contentType = strP.StringF(HTTP::EContentType,RHTTPSession::GetTable());
2a9601315dfc Revision: v2.1.22
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
   518
                if (fieldNameStr == contentType)
2a9601315dfc Revision: v2.1.22
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
   519
                {
2a9601315dfc Revision: v2.1.22
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
   520
                    //LOG(ESOCKET,EInfo,"content type header is  present");
2a9601315dfc Revision: v2.1.22
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
   521
                    TInt err = headers.GetRawField(fieldNameStr,rawFldPtr);
2a9601315dfc Revision: v2.1.22
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
   522
                    TInt index = rawFldPtr.Match(KDRMHeader1);
2a9601315dfc Revision: v2.1.22
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
   523
                    //  LOG1(ESOCKET,EInfo,"rawFldPtr = %s ",rawFldPtr.str());
2a9601315dfc Revision: v2.1.22
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
   524
                    //LOG1(ESOCKET,EInfo,"index of drm header is = %d",index);
2a9601315dfc Revision: v2.1.22
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
   525
                    if (index == 0)
2a9601315dfc Revision: v2.1.22
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
   526
                    {
2a9601315dfc Revision: v2.1.22
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
   527
                        iDrmDownload = true;
2a9601315dfc Revision: v2.1.22
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
   528
                    }
2a9601315dfc Revision: v2.1.22
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
   529
                    else
2a9601315dfc Revision: v2.1.22
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
   530
                    {
2a9601315dfc Revision: v2.1.22
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
   531
                        index = rawFldPtr.Match(KDRMHeader2);
2a9601315dfc Revision: v2.1.22
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
   532
                        if (index == 0)
2a9601315dfc Revision: v2.1.22
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
   533
                            iDrmDownload = true;
2a9601315dfc Revision: v2.1.22
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
   534
                    }
2a9601315dfc Revision: v2.1.22
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
   535
                }
2a9601315dfc Revision: v2.1.22
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
   536
                ++it;
2a9601315dfc Revision: v2.1.22
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
   537
            }
2a9601315dfc Revision: v2.1.22
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
   538
            while (!it.AtEnd());
2a9601315dfc Revision: v2.1.22
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
   539
2a9601315dfc Revision: v2.1.22
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
   540
            GetSecurityInfo();
2a9601315dfc Revision: v2.1.22
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
   541
            if (iJavaWaitingOnCallBack)
2a9601315dfc Revision: v2.1.22
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
   542
            {
2a9601315dfc Revision: v2.1.22
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
   543
                iJavaWaitingOnCallBack=EFalse;
2a9601315dfc Revision: v2.1.22
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
   544
                //LOG(ESOCKET,EInfo,"CHttpTransactionClient::MHFRunL Notifiy Java Got Response");
2a9601315dfc Revision: v2.1.22
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
   545
                iObserver->SubmitComplete(iStatus);
2a9601315dfc Revision: v2.1.22
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
   546
            }
2a9601315dfc Revision: v2.1.22
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
   547
            break;
2a9601315dfc Revision: v2.1.22
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
   548
        }
2a9601315dfc Revision: v2.1.22
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
   549
        case THTTPEvent::EResponseComplete:
2a9601315dfc Revision: v2.1.22
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
   550
        {
2a9601315dfc Revision: v2.1.22
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
   551
            LOG(ESOCKET,EInfo,"MHFRunL EResponseComplete");
2a9601315dfc Revision: v2.1.22
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
   552
            if (iJavaWaitingOnReadCallBack)
2a9601315dfc Revision: v2.1.22
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
   553
            {
2a9601315dfc Revision: v2.1.22
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
   554
                LOG(ESOCKET,EInfo,"Notifiy Read EOF / Cancel");
2a9601315dfc Revision: v2.1.22
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
   555
                iJavaWaitingOnCallBack=EFalse;
2a9601315dfc Revision: v2.1.22
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
   556
                iStatus=CHttpTransactionClient::EComplete;
2a9601315dfc Revision: v2.1.22
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
   557
                if (iDrmDownload == false)
2a9601315dfc Revision: v2.1.22
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
   558
                    iObserver->DataReadyForRead(-1);
2a9601315dfc Revision: v2.1.22
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
   559
            }
2a9601315dfc Revision: v2.1.22
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
   560
2a9601315dfc Revision: v2.1.22
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
   561
            break;
2a9601315dfc Revision: v2.1.22
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
   562
        }
2a9601315dfc Revision: v2.1.22
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
   563
        case THTTPEvent::EUnrecoverableError:
2a9601315dfc Revision: v2.1.22
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
   564
        case THTTPEvent::ETooMuchRequestData:
2a9601315dfc Revision: v2.1.22
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
   565
        case THTTPEvent::EFailed:
2a9601315dfc Revision: v2.1.22
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
   566
        {
2a9601315dfc Revision: v2.1.22
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
   567
            LOG(ESOCKET,EInfo, "MHFRunL EUnrecoverableError/EFailed");
2a9601315dfc Revision: v2.1.22
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
   568
            iStatus=CHttpTransactionClient::EFailed;
2a9601315dfc Revision: v2.1.22
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
   569
            NotifyErrorL(iStatus);
2a9601315dfc Revision: v2.1.22
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
   570
            break;
2a9601315dfc Revision: v2.1.22
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
   571
        }
2a9601315dfc Revision: v2.1.22
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
   572
        case THTTPEvent::EGotResponseBodyData:
2a9601315dfc Revision: v2.1.22
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
   573
        {
2a9601315dfc Revision: v2.1.22
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
   574
            LOG(ESOCKET,EInfo,"MHFRunL EGotResponseBodyData");
2a9601315dfc Revision: v2.1.22
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
   575
            iReleasedData=EFalse;
2a9601315dfc Revision: v2.1.22
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
   576
            //More data is ready for Java to read.
2a9601315dfc Revision: v2.1.22
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
   577
            iRespBody = aTransaction.Response().Body();
2a9601315dfc Revision: v2.1.22
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
   578
2a9601315dfc Revision: v2.1.22
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
   579
            TPtrC8 bodyData;
2a9601315dfc Revision: v2.1.22
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
   580
            iStatus=KErrNotReady;
2a9601315dfc Revision: v2.1.22
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
   581
            //We may be closing if so we don't want to request more data.
2a9601315dfc Revision: v2.1.22
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
   582
            if (!iClosing)
2a9601315dfc Revision: v2.1.22
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
   583
            {
2a9601315dfc Revision: v2.1.22
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
   584
                if (iDrmDownload == true)
2a9601315dfc Revision: v2.1.22
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
   585
                {
2a9601315dfc Revision: v2.1.22
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
   586
                    iFlag = iFlag + 1;
2a9601315dfc Revision: v2.1.22
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
   587
                    iLastChunk = iRespBody->GetNextDataPart(bodyData);
2a9601315dfc Revision: v2.1.22
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
   588
                    TInt curLen = iDrmBuf->Length();
2a9601315dfc Revision: v2.1.22
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
   589
                    TInt reqLen = curLen + bodyData.Length();
2a9601315dfc Revision: v2.1.22
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
   590
                    LOG1(ESOCKET,EInfo," CHttpTransactionClient::MHFRunL DRM case  bodyData.Length() = %d",bodyData.Length());
2a9601315dfc Revision: v2.1.22
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
   591
                    TRAP_IGNORE((iDrmBuf = iDrmBuf->ReAllocL(reqLen + bodyData.Length())));
2a9601315dfc Revision: v2.1.22
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
   592
                    TPtr8 bodyPtr1 = iDrmBuf->Des();
2a9601315dfc Revision: v2.1.22
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
   593
                    //HBufC8* bodyBuffer1 = HBufC8::NewLC(bodyData.Length());
2a9601315dfc Revision: v2.1.22
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
   594
                    LOG1(ESOCKET,EInfo,"length of iDrmBuf = %d", iDrmBuf->Length());
2a9601315dfc Revision: v2.1.22
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
   595
                    bodyPtr1.Append(bodyData);
2a9601315dfc Revision: v2.1.22
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
   596
                    iRespBody->ReleaseData();
2a9601315dfc Revision: v2.1.22
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
   597
2a9601315dfc Revision: v2.1.22
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
   598
2a9601315dfc Revision: v2.1.22
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
   599
                    iStatus = CHttpTransactionClient::EGotResponseBodyData;
2a9601315dfc Revision: v2.1.22
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
   600
                    //if(iFlag == 1)
2a9601315dfc Revision: v2.1.22
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
   601
                    TInt bodyDataPartLength;
2a9601315dfc Revision: v2.1.22
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
   602
                    bodyDataPartLength = iDrmBuf->Length();
2a9601315dfc Revision: v2.1.22
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
   603
                    TInt  bytesLeftInBuffer = bodyDataPartLength-iJavaReadOffset;
2a9601315dfc Revision: v2.1.22
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
   604
                    if (bytesLeftInBuffer > 0)
2a9601315dfc Revision: v2.1.22
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
   605
                        iObserver->DataReadyForRead(bytesLeftInBuffer);
2a9601315dfc Revision: v2.1.22
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
   606
                }
2a9601315dfc Revision: v2.1.22
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
   607
                else
2a9601315dfc Revision: v2.1.22
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
   608
                {
2a9601315dfc Revision: v2.1.22
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
   609
                    iLastChunk = iRespBody->GetNextDataPart(bodyData);
2a9601315dfc Revision: v2.1.22
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
   610
                    HBufC8* bodyBuffer = HBufC8::NewLC(bodyData.Length());
2a9601315dfc Revision: v2.1.22
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
   611
                    LOG1(ESOCKET,EInfo," CHttpTransactionClient::MHFRunL after getnextdatapart ,bodyData.Length() = %d",bodyData.Length());
2a9601315dfc Revision: v2.1.22
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
   612
                    TPtr8 bodyPtr = bodyBuffer->Des();
2a9601315dfc Revision: v2.1.22
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
   613
                    bodyPtr.Append(bodyData);
2a9601315dfc Revision: v2.1.22
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
   614
                    if (iBuf)
2a9601315dfc Revision: v2.1.22
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
   615
                    {
2a9601315dfc Revision: v2.1.22
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
   616
                        delete iBuf;
2a9601315dfc Revision: v2.1.22
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
   617
                        iBuf = NULL;
2a9601315dfc Revision: v2.1.22
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
   618
                    }
2a9601315dfc Revision: v2.1.22
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
   619
                    CleanupStack::Pop(bodyBuffer);
2a9601315dfc Revision: v2.1.22
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
   620
                    iBuf = bodyBuffer;
2a9601315dfc Revision: v2.1.22
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
   621
                    iStatus = CHttpTransactionClient::EGotResponseBodyData;
2a9601315dfc Revision: v2.1.22
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
   622
                    LOG(ESOCKET,EInfo," CHttpTransactionClient::MHFRunL Notify got more data");
2a9601315dfc Revision: v2.1.22
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
   623
                    iObserver->DataReadyForRead(iStatus);
2a9601315dfc Revision: v2.1.22
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
   624
                }
2a9601315dfc Revision: v2.1.22
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
   625
            }
2a9601315dfc Revision: v2.1.22
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
   626
2a9601315dfc Revision: v2.1.22
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
   627
            break;
2a9601315dfc Revision: v2.1.22
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
   628
        }
2a9601315dfc Revision: v2.1.22
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
   629
        case THTTPEvent::ENotifyNewRequestBodyPart:
2a9601315dfc Revision: v2.1.22
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
   630
        {
2a9601315dfc Revision: v2.1.22
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
   631
            LOG(ESOCKET,EInfo,"MHFRunL ENotifyNewRequestBodyPart");
2a9601315dfc Revision: v2.1.22
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
   632
            iStatus = CHttpTransactionClient::ERequestNextBodayData;
2a9601315dfc Revision: v2.1.22
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
   633
            break;
2a9601315dfc Revision: v2.1.22
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
   634
        }
49
35baca0e7a2e v2.2.3_1
hgs
parents: 35
diff changeset
   635
35
85266cc22c7f Revision: v2.2.1
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents: 23
diff changeset
   636
        case THTTPEvent::EReceiveTimeOut:
85266cc22c7f Revision: v2.2.1
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents: 23
diff changeset
   637
        {
49
35baca0e7a2e v2.2.3_1
hgs
parents: 35
diff changeset
   638
            ELOG(ESOCKET,"MHFRunL EReceiveTimeOut");
35baca0e7a2e v2.2.3_1
hgs
parents: 35
diff changeset
   639
            NotifyErrorL(KErrTimedOut);  // send timeout error to java
35baca0e7a2e v2.2.3_1
hgs
parents: 35
diff changeset
   640
            break;
35baca0e7a2e v2.2.3_1
hgs
parents: 35
diff changeset
   641
35baca0e7a2e v2.2.3_1
hgs
parents: 35
diff changeset
   642
        }
21
2a9601315dfc Revision: v2.1.22
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
   643
        /*
2a9601315dfc Revision: v2.1.22
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
   644
        * -j2me expects the http stack to be able to post body data with no content type
2a9601315dfc Revision: v2.1.22
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
   645
        *   the native stack default validation filter does not allow this.
2a9601315dfc Revision: v2.1.22
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
   646
        * -j2me expects the http stack to allow post requests to have body data
2a9601315dfc Revision: v2.1.22
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
   647
        *   the native stack default validation filter does not allow this. */
2a9601315dfc Revision: v2.1.22
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
   648
        case KErrHttpEntityHeaderMissingContentType:
2a9601315dfc Revision: v2.1.22
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
   649
        case KErrHttpInvalidHeaderInRequest:
2a9601315dfc Revision: v2.1.22
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
   650
        case KErrHttpGeneralHeaderMissingHost:
2a9601315dfc Revision: v2.1.22
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
   651
            break;
2a9601315dfc Revision: v2.1.22
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
   652
2a9601315dfc Revision: v2.1.22
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
   653
        case THTTPEvent::ERedirectRequiresConfirmation:
2a9601315dfc Revision: v2.1.22
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
   654
        {
2a9601315dfc Revision: v2.1.22
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
   655
            LOG(ESOCKET,EInfo,"MHFRunL ERedirectRequiresConfirmation");
2a9601315dfc Revision: v2.1.22
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
   656
        }
2a9601315dfc Revision: v2.1.22
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
   657
        case THTTPEvent::ENeedTunnel:
2a9601315dfc Revision: v2.1.22
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
   658
        {
2a9601315dfc Revision: v2.1.22
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
   659
            LOG(ESOCKET,EInfo,"MHFRunL ENeedTunnel");
2a9601315dfc Revision: v2.1.22
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
   660
        }
2a9601315dfc Revision: v2.1.22
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
   661
        case THTTPEvent::EGetCipherSuite:
2a9601315dfc Revision: v2.1.22
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
   662
        {
2a9601315dfc Revision: v2.1.22
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
   663
            LOG(ESOCKET,EInfo,"MHFRunL EGetCipherSuite");
2a9601315dfc Revision: v2.1.22
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
   664
        }
2a9601315dfc Revision: v2.1.22
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
   665
        default:
2a9601315dfc Revision: v2.1.22
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
   666
        {
2a9601315dfc Revision: v2.1.22
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
   667
            LOG(ESOCKET,EInfo,"MHFRunL Unkown Event");
2a9601315dfc Revision: v2.1.22
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
   668
            //__ASSERT_DEBUGCOMP( EFalse, User::Panic(_L("Unhandled native Http event"), aEvent.iStatus) );
2a9601315dfc Revision: v2.1.22
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
   669
            NotifyErrorL(aEvent.iStatus);
2a9601315dfc Revision: v2.1.22
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
   670
            break;
2a9601315dfc Revision: v2.1.22
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
   671
        }
2a9601315dfc Revision: v2.1.22
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
   672
        };
2a9601315dfc Revision: v2.1.22
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
   673
    }
2a9601315dfc Revision: v2.1.22
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
   674
    LOG(ESOCKET,EInfo,"CHttpTransactionClient::MHFRunL -");
2a9601315dfc Revision: v2.1.22
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
   675
}
2a9601315dfc Revision: v2.1.22
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
   676
2a9601315dfc Revision: v2.1.22
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
   677
TInt CHttpTransactionClient::MHFRunError(TInt aError, RHTTPTransaction aTransaction, const THTTPEvent& /*aEvent*/)
2a9601315dfc Revision: v2.1.22
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
   678
{
2a9601315dfc Revision: v2.1.22
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
   679
    LOG1(ESOCKET,EInfo," CHttpTransactionClient::MHFRunError: %d ",aError);
2a9601315dfc Revision: v2.1.22
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
   680
    if (aError!=KErrNone && iTransaction== aTransaction)
2a9601315dfc Revision: v2.1.22
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
   681
    {
2a9601315dfc Revision: v2.1.22
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
   682
        iStatus=CHttpTransactionClient::EFailed;
2a9601315dfc Revision: v2.1.22
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
   683
        if (iJavaWaitingOnCallBack)
2a9601315dfc Revision: v2.1.22
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
   684
            iObserver->SubmitComplete(iStatus);
2a9601315dfc Revision: v2.1.22
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
   685
2a9601315dfc Revision: v2.1.22
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
   686
2a9601315dfc Revision: v2.1.22
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
   687
        if (iJavaWaitingOnReadCallBack)
2a9601315dfc Revision: v2.1.22
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
   688
        {
2a9601315dfc Revision: v2.1.22
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
   689
            LOG(ESOCKET,EInfo,"Notifiy Read EOF / Cancel");
2a9601315dfc Revision: v2.1.22
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
   690
            iJavaWaitingOnCallBack=EFalse;
2a9601315dfc Revision: v2.1.22
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
   691
            iObserver->DataReadyForRead(-1);
2a9601315dfc Revision: v2.1.22
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
   692
        }
2a9601315dfc Revision: v2.1.22
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
   693
2a9601315dfc Revision: v2.1.22
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
   694
    }
2a9601315dfc Revision: v2.1.22
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
   695
    return aError;
2a9601315dfc Revision: v2.1.22
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
   696
}
2a9601315dfc Revision: v2.1.22
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
   697
2a9601315dfc Revision: v2.1.22
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
   698
/*
2a9601315dfc Revision: v2.1.22
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
   699
* Java may be waiting on an async call back
2a9601315dfc Revision: v2.1.22
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
   700
* If this is the case notify of the error code so we don't block java.
2a9601315dfc Revision: v2.1.22
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
   701
*/
2a9601315dfc Revision: v2.1.22
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
   702
2a9601315dfc Revision: v2.1.22
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
   703
void CHttpTransactionClient::NotifyErrorL(TInt aErrorCode)
2a9601315dfc Revision: v2.1.22
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
   704
{
80
d6dafc5d983f v2.2.19_1
hgs
parents: 49
diff changeset
   705
    ELOG1(ESOCKET," CHttpTransactionClient::NotifyErrorL: %d ",aErrorCode);
21
2a9601315dfc Revision: v2.1.22
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
   706
    if ((aErrorCode  ==  KErrNotReady))
2a9601315dfc Revision: v2.1.22
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
   707
    {
2a9601315dfc Revision: v2.1.22
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
   708
        iTransaction.Cancel();
2a9601315dfc Revision: v2.1.22
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
   709
        iHttpSession.RestartConnection();
87
1627c337e51e v2.2.21_1
hgs
parents: 80
diff changeset
   710
        iRestartedFlag = true;
21
2a9601315dfc Revision: v2.1.22
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
   711
2a9601315dfc Revision: v2.1.22
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
   712
    }
2a9601315dfc Revision: v2.1.22
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
   713
    if (iJavaWaitingOnCallBack)
2a9601315dfc Revision: v2.1.22
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
   714
    {
2a9601315dfc Revision: v2.1.22
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
   715
        iJavaWaitingOnCallBack=EFalse;
2a9601315dfc Revision: v2.1.22
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
   716
        LOG(ESOCKET,EInfo,"CHttpTransactionClient::MHFRunL  Notifiy Java unknown Event");
2a9601315dfc Revision: v2.1.22
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
   717
        iObserver->SubmitComplete(aErrorCode);
2a9601315dfc Revision: v2.1.22
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
   718
    }
2a9601315dfc Revision: v2.1.22
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
   719
    if (iJavaWaitingOnReadCallBack)
2a9601315dfc Revision: v2.1.22
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
   720
    {
2a9601315dfc Revision: v2.1.22
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
   721
        LOG(ESOCKET,EInfo,"Notifiy Read EOF / Cancel");
2a9601315dfc Revision: v2.1.22
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
   722
        iJavaWaitingOnCallBack=EFalse;
2a9601315dfc Revision: v2.1.22
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
   723
        //Notify Java of error if it is waiting for a read
35
85266cc22c7f Revision: v2.2.1
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents: 23
diff changeset
   724
        iObserver->DataReadyForRead(aErrorCode);
21
2a9601315dfc Revision: v2.1.22
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
   725
    }
2a9601315dfc Revision: v2.1.22
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
   726
2a9601315dfc Revision: v2.1.22
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
   727
}
2a9601315dfc Revision: v2.1.22
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
   728
2a9601315dfc Revision: v2.1.22
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
   729
2a9601315dfc Revision: v2.1.22
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
   730
void CHttpTransactionClient::CloseTransaction()
2a9601315dfc Revision: v2.1.22
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
   731
{
2a9601315dfc Revision: v2.1.22
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
   732
    LOG(ESOCKET,EInfo,"CHttpTransactionClient::CloseTransaction + ");
2a9601315dfc Revision: v2.1.22
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
   733
    iClosing=ETrue;
2a9601315dfc Revision: v2.1.22
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
   734
    if (!iReleasedData)
2a9601315dfc Revision: v2.1.22
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
   735
    {
2a9601315dfc Revision: v2.1.22
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
   736
        LOG(ESOCKET,EInfo,"CHttpTransactionClient::CloseTransaction NOT RELEASED DATA!!! release and close");
2a9601315dfc Revision: v2.1.22
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
   737
        if (iDrmDownload == false)
2a9601315dfc Revision: v2.1.22
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
   738
            iRespBody->ReleaseData();
2a9601315dfc Revision: v2.1.22
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
   739
        iReleasedData=ETrue;
2a9601315dfc Revision: v2.1.22
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
   740
    }
2a9601315dfc Revision: v2.1.22
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
   741
    iTransaction.Close();
2a9601315dfc Revision: v2.1.22
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
   742
    iClosing=EFalse;
2a9601315dfc Revision: v2.1.22
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
   743
    LOG(ESOCKET,EInfo,"CHttpTransactionClient::CloseTransaction - ");
2a9601315dfc Revision: v2.1.22
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
   744
}
2a9601315dfc Revision: v2.1.22
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
   745
2a9601315dfc Revision: v2.1.22
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
   746
CHttpTransactionClient::~CHttpTransactionClient()
2a9601315dfc Revision: v2.1.22
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
   747
{
2a9601315dfc Revision: v2.1.22
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
   748
    LOG(ESOCKET,EInfo,"CHttpTransactionClient::~CHttpTransactionClient");
2a9601315dfc Revision: v2.1.22
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
   749
    //CloseTransaction();
2a9601315dfc Revision: v2.1.22
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
   750
    if (iBuf)
2a9601315dfc Revision: v2.1.22
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
   751
    {
2a9601315dfc Revision: v2.1.22
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
   752
        delete iBuf;
2a9601315dfc Revision: v2.1.22
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
   753
        iBuf=NULL;
2a9601315dfc Revision: v2.1.22
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
   754
    }
2a9601315dfc Revision: v2.1.22
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
   755
    if (iDrmBuf)
2a9601315dfc Revision: v2.1.22
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
   756
    {
2a9601315dfc Revision: v2.1.22
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
   757
        delete iDrmBuf;
2a9601315dfc Revision: v2.1.22
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
   758
        iDrmBuf=NULL;
2a9601315dfc Revision: v2.1.22
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
   759
    }
2a9601315dfc Revision: v2.1.22
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
   760
    delete iCertInfo;
2a9601315dfc Revision: v2.1.22
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
   761
}
2a9601315dfc Revision: v2.1.22
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
   762
2a9601315dfc Revision: v2.1.22
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
   763
2a9601315dfc Revision: v2.1.22
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
   764
/** Obtain a data part from the supplier.  The data is guaranteed
2a9601315dfc Revision: v2.1.22
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
   765
    to survive until a call is made to ReleaseData().
2a9601315dfc Revision: v2.1.22
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
   766
    @param aDataPart - the data part
2a9601315dfc Revision: v2.1.22
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
   767
    @return ETrue if this is the last part. EFalse otherwise */
2a9601315dfc Revision: v2.1.22
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
   768
TBool CHttpTransactionClient::GetNextDataPart(TPtrC8& aDataPart)
2a9601315dfc Revision: v2.1.22
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
   769
{
2a9601315dfc Revision: v2.1.22
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
   770
    LOG(ESOCKET,EInfo,"CHttpTransactionClient::GetNextDataPart");
80
d6dafc5d983f v2.2.19_1
hgs
parents: 49
diff changeset
   771
    TBool lastPart=ETrue;
d6dafc5d983f v2.2.19_1
hgs
parents: 49
diff changeset
   772
21
2a9601315dfc Revision: v2.1.22
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
   773
    if (iBuf!=NULL)
2a9601315dfc Revision: v2.1.22
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
   774
    {
80
d6dafc5d983f v2.2.19_1
hgs
parents: 49
diff changeset
   775
        // in-case of non-chunked, this is the end of POST data
21
2a9601315dfc Revision: v2.1.22
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
   776
        aDataPart.Set(iBuf->Des());
2a9601315dfc Revision: v2.1.22
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
   777
    }
80
d6dafc5d983f v2.2.19_1
hgs
parents: 49
diff changeset
   778
    if (iPartialPostData)
d6dafc5d983f v2.2.19_1
hgs
parents: 49
diff changeset
   779
    {
d6dafc5d983f v2.2.19_1
hgs
parents: 49
diff changeset
   780
        lastPart = iEndOfRequest;
d6dafc5d983f v2.2.19_1
hgs
parents: 49
diff changeset
   781
    }
d6dafc5d983f v2.2.19_1
hgs
parents: 49
diff changeset
   782
    LOG1(ESOCKET,EInfo,"CHttpTransactionClient::GetNextDataPart, returning : %d", lastPart);
21
2a9601315dfc Revision: v2.1.22
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
   783
    return lastPart;
2a9601315dfc Revision: v2.1.22
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
   784
}
2a9601315dfc Revision: v2.1.22
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
   785
2a9601315dfc Revision: v2.1.22
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
   786
/** Release the current data part being held at the data
2a9601315dfc Revision: v2.1.22
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
   787
    supplier.  This call indicates to the supplier that the part
2a9601315dfc Revision: v2.1.22
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
   788
    is no longer needed, and another one can be supplied, if
2a9601315dfc Revision: v2.1.22
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
   789
    appropriate.  */
2a9601315dfc Revision: v2.1.22
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
   790
void CHttpTransactionClient::ReleaseData()
2a9601315dfc Revision: v2.1.22
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
   791
{
80
d6dafc5d983f v2.2.19_1
hgs
parents: 49
diff changeset
   792
    LOG(ESOCKET,EInfo," CHttpTransactionClient::ReleaseData: ");
21
2a9601315dfc Revision: v2.1.22
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
   793
    if (iBuf)
2a9601315dfc Revision: v2.1.22
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
   794
    {
2a9601315dfc Revision: v2.1.22
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
   795
        delete iBuf;
2a9601315dfc Revision: v2.1.22
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
   796
        iBuf=NULL;
2a9601315dfc Revision: v2.1.22
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
   797
    }
80
d6dafc5d983f v2.2.19_1
hgs
parents: 49
diff changeset
   798
    if (iPartialPostData)
d6dafc5d983f v2.2.19_1
hgs
parents: 49
diff changeset
   799
    {
d6dafc5d983f v2.2.19_1
hgs
parents: 49
diff changeset
   800
        // inform the java side that post data is consumed
d6dafc5d983f v2.2.19_1
hgs
parents: 49
diff changeset
   801
        TRAP_IGNORE(iObserver->DoPostCallBack());
d6dafc5d983f v2.2.19_1
hgs
parents: 49
diff changeset
   802
    }
d6dafc5d983f v2.2.19_1
hgs
parents: 49
diff changeset
   803
21
2a9601315dfc Revision: v2.1.22
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
   804
}
2a9601315dfc Revision: v2.1.22
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
   805
2a9601315dfc Revision: v2.1.22
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
   806
/** Obtain the overall size of the data being supplied, if known
2a9601315dfc Revision: v2.1.22
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
   807
    to the supplier.  Where a body of data is supplied in several
2a9601315dfc Revision: v2.1.22
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
   808
    parts this size will be the sum of all the part sizes. If
2a9601315dfc Revision: v2.1.22
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
   809
    the size is not known, KErrNotFound is returned; in this case
2a9601315dfc Revision: v2.1.22
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
   810
    the client must use the return code of GetNextDataPart to find
2a9601315dfc Revision: v2.1.22
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
   811
    out when the data is complete.
2a9601315dfc Revision: v2.1.22
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
   812
2a9601315dfc Revision: v2.1.22
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
   813
    @return A size in bytes, or KErrNotFound if the size is not known.  */
2a9601315dfc Revision: v2.1.22
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
   814
TInt CHttpTransactionClient::OverallDataSize()
2a9601315dfc Revision: v2.1.22
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
   815
{
2a9601315dfc Revision: v2.1.22
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
   816
    TInt overallSize = KErrNotFound;
80
d6dafc5d983f v2.2.19_1
hgs
parents: 49
diff changeset
   817
    if (iPartialPostData == true)
d6dafc5d983f v2.2.19_1
hgs
parents: 49
diff changeset
   818
    {
d6dafc5d983f v2.2.19_1
hgs
parents: 49
diff changeset
   819
        overallSize = KErrNotFound;
d6dafc5d983f v2.2.19_1
hgs
parents: 49
diff changeset
   820
    }
d6dafc5d983f v2.2.19_1
hgs
parents: 49
diff changeset
   821
    else if (iBuf)
21
2a9601315dfc Revision: v2.1.22
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
   822
    {
2a9601315dfc Revision: v2.1.22
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
   823
        overallSize=iBuf->Length();
2a9601315dfc Revision: v2.1.22
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
   824
    }
2a9601315dfc Revision: v2.1.22
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
   825
    LOG1(ESOCKET,EInfo," CHttpTransactionClient::OverallDataSize: %d",overallSize);
2a9601315dfc Revision: v2.1.22
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
   826
    return overallSize;
2a9601315dfc Revision: v2.1.22
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
   827
}
2a9601315dfc Revision: v2.1.22
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
   828
80
d6dafc5d983f v2.2.19_1
hgs
parents: 49
diff changeset
   829
void CHttpTransactionClient::PostDataL(HBufC8* aPostData, const bool aEndOfRequest)
d6dafc5d983f v2.2.19_1
hgs
parents: 49
diff changeset
   830
{
d6dafc5d983f v2.2.19_1
hgs
parents: 49
diff changeset
   831
    LOG(ESOCKET,EInfo,"CHttpTransactionClient::PostData ");
d6dafc5d983f v2.2.19_1
hgs
parents: 49
diff changeset
   832
    iEndOfRequest = aEndOfRequest;
d6dafc5d983f v2.2.19_1
hgs
parents: 49
diff changeset
   833
    if (aPostData!=NULL && aPostData->Length()>0)
d6dafc5d983f v2.2.19_1
hgs
parents: 49
diff changeset
   834
    {
d6dafc5d983f v2.2.19_1
hgs
parents: 49
diff changeset
   835
        iBuf=aPostData;
d6dafc5d983f v2.2.19_1
hgs
parents: 49
diff changeset
   836
    }
d6dafc5d983f v2.2.19_1
hgs
parents: 49
diff changeset
   837
    else
d6dafc5d983f v2.2.19_1
hgs
parents: 49
diff changeset
   838
    {
d6dafc5d983f v2.2.19_1
hgs
parents: 49
diff changeset
   839
        HBufC8* buf = HBufC8::NewL(1);      // descriptor of length 0
d6dafc5d983f v2.2.19_1
hgs
parents: 49
diff changeset
   840
        iBuf = buf;
d6dafc5d983f v2.2.19_1
hgs
parents: 49
diff changeset
   841
    }
d6dafc5d983f v2.2.19_1
hgs
parents: 49
diff changeset
   842
    iTransaction.NotifyNewRequestBodyPartL();  // notify the stack that new request body data is available
d6dafc5d983f v2.2.19_1
hgs
parents: 49
diff changeset
   843
d6dafc5d983f v2.2.19_1
hgs
parents: 49
diff changeset
   844
d6dafc5d983f v2.2.19_1
hgs
parents: 49
diff changeset
   845
}
d6dafc5d983f v2.2.19_1
hgs
parents: 49
diff changeset
   846
21
2a9601315dfc Revision: v2.1.22
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
   847
/** Reset the data supplier.  This indicates to the data supplier that it should
2a9601315dfc Revision: v2.1.22
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
   848
    return to the first part of the data.  This could be used in a situation where
2a9601315dfc Revision: v2.1.22
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
   849
    the data consumer has encountered an error and needs the data to be supplied
2a9601315dfc Revision: v2.1.22
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
   850
    afresh.  Even if the last part has been supplied (i.e. GetNextDataPart has
2a9601315dfc Revision: v2.1.22
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
   851
    returned ETrue), the data supplier should reset to the first part.
2a9601315dfc Revision: v2.1.22
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
   852
2a9601315dfc Revision: v2.1.22
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
   853
    If the supplier cannot reset it should return an error code; otherwise it should
2a9601315dfc Revision: v2.1.22
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
   854
    return KErrNone, where the reset will be assumed to have succeeded*/
2a9601315dfc Revision: v2.1.22
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
   855
TInt CHttpTransactionClient::Reset()
2a9601315dfc Revision: v2.1.22
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
   856
{
2a9601315dfc Revision: v2.1.22
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
   857
    LOG(ESOCKET,EInfo,"CHttpTransactionClient::Reset");
80
d6dafc5d983f v2.2.19_1
hgs
parents: 49
diff changeset
   858
    ELOG1(ESOCKET, "Reset() , Tran = %d", iTransaction.Id());
d6dafc5d983f v2.2.19_1
hgs
parents: 49
diff changeset
   859
    TInt err = 0;
d6dafc5d983f v2.2.19_1
hgs
parents: 49
diff changeset
   860
    if(iPartialPostData == false)
d6dafc5d983f v2.2.19_1
hgs
parents: 49
diff changeset
   861
    {
d6dafc5d983f v2.2.19_1
hgs
parents: 49
diff changeset
   862
        err = KErrNone; 
d6dafc5d983f v2.2.19_1
hgs
parents: 49
diff changeset
   863
    }
d6dafc5d983f v2.2.19_1
hgs
parents: 49
diff changeset
   864
    else
d6dafc5d983f v2.2.19_1
hgs
parents: 49
diff changeset
   865
    {
d6dafc5d983f v2.2.19_1
hgs
parents: 49
diff changeset
   866
        err = KErrNotSupported;
d6dafc5d983f v2.2.19_1
hgs
parents: 49
diff changeset
   867
    }
21
2a9601315dfc Revision: v2.1.22
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
   868
    return err;
2a9601315dfc Revision: v2.1.22
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
   869
}
2a9601315dfc Revision: v2.1.22
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
   870
2a9601315dfc Revision: v2.1.22
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
   871
2a9601315dfc Revision: v2.1.22
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
   872
MNativeSecureConnectionInformation* CHttpTransactionClient::GetSecurityInfo()
2a9601315dfc Revision: v2.1.22
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
   873
{
2a9601315dfc Revision: v2.1.22
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
   874
    //LOG(ESOCKET,EInfo,"CHttpTransactionClient::GetSecurityInfo");
2a9601315dfc Revision: v2.1.22
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
   875
    MNativeSecureConnectionInformation* handle=NULL;
2a9601315dfc Revision: v2.1.22
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
   876
    if (!iCertInfo)
2a9601315dfc Revision: v2.1.22
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
   877
    {
2a9601315dfc Revision: v2.1.22
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
   878
        TRAP_IGNORE(GetCertInfoL());
2a9601315dfc Revision: v2.1.22
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
   879
        //If we fail to read the cert java is returned a null handle.
2a9601315dfc Revision: v2.1.22
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
   880
    }
2a9601315dfc Revision: v2.1.22
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
   881
    if (iCertInfo)
2a9601315dfc Revision: v2.1.22
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
   882
    {
2a9601315dfc Revision: v2.1.22
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
   883
        handle = iCertInfo;
2a9601315dfc Revision: v2.1.22
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
   884
    }
2a9601315dfc Revision: v2.1.22
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
   885
    return handle;
2a9601315dfc Revision: v2.1.22
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
   886
}
2a9601315dfc Revision: v2.1.22
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
   887
2a9601315dfc Revision: v2.1.22
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
   888
void CHttpTransactionClient::GetCertInfoL()
2a9601315dfc Revision: v2.1.22
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
   889
{
2a9601315dfc Revision: v2.1.22
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
   890
    //LOG(ESOCKET,EInfo,"CHttpTransactionClient::GetCertInfoL ");
2a9601315dfc Revision: v2.1.22
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
   891
    TCertInfo info;
2a9601315dfc Revision: v2.1.22
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
   892
2a9601315dfc Revision: v2.1.22
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
   893
    //Get the server certificate
2a9601315dfc Revision: v2.1.22
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
   894
    if (iCertInfo!=NULL)
2a9601315dfc Revision: v2.1.22
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
   895
    {
2a9601315dfc Revision: v2.1.22
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
   896
        delete iCertInfo;
2a9601315dfc Revision: v2.1.22
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
   897
        iCertInfo= NULL;
2a9601315dfc Revision: v2.1.22
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
   898
    }
2a9601315dfc Revision: v2.1.22
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
   899
    const CX509Certificate* cert = static_cast<const CX509Certificate*>(iTransaction.ServerCert());
2a9601315dfc Revision: v2.1.22
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
   900
2a9601315dfc Revision: v2.1.22
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
   901
    TInt err = iTransaction.ServerCert(info);
2a9601315dfc Revision: v2.1.22
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
   902
    if (err==KErrNone)
2a9601315dfc Revision: v2.1.22
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
   903
    {
2a9601315dfc Revision: v2.1.22
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
   904
        //Get the cipher suite
2a9601315dfc Revision: v2.1.22
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
   905
        const TDesC8& cipherCode = iTransaction.CipherSuite().DesC();
2a9601315dfc Revision: v2.1.22
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
   906
        if (!cipherCode.Length())
2a9601315dfc Revision: v2.1.22
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
   907
        {
2a9601315dfc Revision: v2.1.22
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
   908
            //LOG(ESOCKET,EInfo, "CHttpTransactionClient::GetCertInfoL No Cipher Suite Name found in Transaction");
2a9601315dfc Revision: v2.1.22
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
   909
            User::Leave(KErrNotFound);
2a9601315dfc Revision: v2.1.22
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
   910
        }
2a9601315dfc Revision: v2.1.22
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
   911
2a9601315dfc Revision: v2.1.22
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
   912
        HBufC* cipherSuiteBuf = HBufC::NewLC(KMaxCipherSuiteDescriptionLength);
2a9601315dfc Revision: v2.1.22
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
   913
2a9601315dfc Revision: v2.1.22
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
   914
        const TDesC8& cipherDesc = CipherSuiteDescription(cipherCode);
2a9601315dfc Revision: v2.1.22
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
   915
        if (cipherDesc.Length())
2a9601315dfc Revision: v2.1.22
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
   916
        {
2a9601315dfc Revision: v2.1.22
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
   917
            cipherSuiteBuf->Des().Copy(cipherDesc);
2a9601315dfc Revision: v2.1.22
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
   918
        }
2a9601315dfc Revision: v2.1.22
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
   919
        else
2a9601315dfc Revision: v2.1.22
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
   920
        {
2a9601315dfc Revision: v2.1.22
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
   921
            // We will use the code as no description is available.
2a9601315dfc Revision: v2.1.22
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
   922
            //LOG(ESOCKET,EInfo, "CHttpTransactionClient::GetCertInfoL No Cipher Suite description found");
2a9601315dfc Revision: v2.1.22
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
   923
            cipherSuiteBuf->Des().Copy(cipherCode);
2a9601315dfc Revision: v2.1.22
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
   924
        }
2a9601315dfc Revision: v2.1.22
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
   925
2a9601315dfc Revision: v2.1.22
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
   926
        CleanupStack::Pop(cipherSuiteBuf);
2a9601315dfc Revision: v2.1.22
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
   927
        iCertInfo= CHttpsCertInfo::NewL(*cert,cipherSuiteBuf);
2a9601315dfc Revision: v2.1.22
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
   928
    }
2a9601315dfc Revision: v2.1.22
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
   929
}
2a9601315dfc Revision: v2.1.22
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
   930
2a9601315dfc Revision: v2.1.22
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
   931
TInt CHttpTransactionClient::Available()
2a9601315dfc Revision: v2.1.22
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
   932
{
2a9601315dfc Revision: v2.1.22
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
   933
    TInt avail=KErrNone;
2a9601315dfc Revision: v2.1.22
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
   934
    if (iBuf)
2a9601315dfc Revision: v2.1.22
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
   935
    {
2a9601315dfc Revision: v2.1.22
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
   936
        avail=(iBuf->Length()-iJavaReadOffset);
2a9601315dfc Revision: v2.1.22
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
   937
    }
2a9601315dfc Revision: v2.1.22
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
   938
    LOG1(ESOCKET,EInfo," CHttpTransactionClient::Available: %d ",avail);
2a9601315dfc Revision: v2.1.22
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
   939
    return avail;
2a9601315dfc Revision: v2.1.22
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
   940
}
2a9601315dfc Revision: v2.1.22
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
   941
2a9601315dfc Revision: v2.1.22
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
   942
void CHttpTransactionClient::SetHTTPAuthenticationCallbackL(MHTTPAuthenticationCallback& aCallBack)
2a9601315dfc Revision: v2.1.22
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
   943
{
2a9601315dfc Revision: v2.1.22
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
   944
    aCallBack.InstallAuthenticationL(iHttpSession.Session());
2a9601315dfc Revision: v2.1.22
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
   945
}
2a9601315dfc Revision: v2.1.22
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
   946
2a9601315dfc Revision: v2.1.22
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
   947
2a9601315dfc Revision: v2.1.22
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
   948
// NOTE : When adding a new cipher description string,
2a9601315dfc Revision: v2.1.22
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
   949
// make sure KMaxCipherSuiteDescriptionLength is greater than the length.
2a9601315dfc Revision: v2.1.22
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
   950
const TDesC8& CHttpTransactionClient::CipherSuiteDescription(const TDesC8& aCode)
2a9601315dfc Revision: v2.1.22
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
   951
{
2a9601315dfc Revision: v2.1.22
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
   952
    TInt length = aCode.Length();
2a9601315dfc Revision: v2.1.22
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
   953
    if (length < 2)
2a9601315dfc Revision: v2.1.22
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
   954
    {
2a9601315dfc Revision: v2.1.22
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
   955
        // This is not a TLS code we recognise.
2a9601315dfc Revision: v2.1.22
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
   956
        //LOG(ESOCKET,EInfo,"CHttpTransactionClient::CipherSuiteDescription, unknown cipher suite");
2a9601315dfc Revision: v2.1.22
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
   957
        return KNullDesC8;
2a9601315dfc Revision: v2.1.22
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
   958
    }
2a9601315dfc Revision: v2.1.22
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
   959
2a9601315dfc Revision: v2.1.22
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
   960
    TInt code = aCode[1];
2a9601315dfc Revision: v2.1.22
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
   961
2a9601315dfc Revision: v2.1.22
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
   962
    //LOG1(ESOCKET,EInfo,"CHttpTransactionClient::CipherSuiteDescription, code=%d", code);
2a9601315dfc Revision: v2.1.22
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
   963
2a9601315dfc Revision: v2.1.22
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
   964
    switch (code)
2a9601315dfc Revision: v2.1.22
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
   965
    {
2a9601315dfc Revision: v2.1.22
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
   966
// The Cipher Suite codes and matching string descriptions are taken from the TLS specification
2a9601315dfc Revision: v2.1.22
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
   967
// (see A.5. The CipherSuite, The TLS Protocol, RFC 2246)
2a9601315dfc Revision: v2.1.22
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
   968
// The list below contains those currently supported by Symbian. See tlstypedef.h
2a9601315dfc Revision: v2.1.22
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
   969
2a9601315dfc Revision: v2.1.22
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
   970
    case 0x03:
2a9601315dfc Revision: v2.1.22
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
   971
        _LIT8(KTls_03, "TLS_RSA_EXPORT_WITH_RC4_40_MD5");
2a9601315dfc Revision: v2.1.22
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
   972
        return KTls_03();
2a9601315dfc Revision: v2.1.22
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
   973
    case 0x04:
2a9601315dfc Revision: v2.1.22
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
   974
        _LIT8(KTls_04, "TLS_RSA_WITH_RC4_128_MD5");
2a9601315dfc Revision: v2.1.22
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
   975
        return KTls_04();
2a9601315dfc Revision: v2.1.22
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
   976
    case 0x05:
2a9601315dfc Revision: v2.1.22
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
   977
        _LIT8(KTls_05, "TLS_RSA_WITH_RC4_128_SHA");
2a9601315dfc Revision: v2.1.22
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
   978
        return KTls_05();
2a9601315dfc Revision: v2.1.22
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
   979
    case 0x08:
2a9601315dfc Revision: v2.1.22
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
   980
        _LIT8(KTls_08, "TLS_RSA_EXPORT_WITH_DES40_CBC_SHA");
2a9601315dfc Revision: v2.1.22
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
   981
        return KTls_08();
2a9601315dfc Revision: v2.1.22
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
   982
    case 0x09:
2a9601315dfc Revision: v2.1.22
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
   983
        _LIT8(KTls_09, "TLS_RSA_WITH_DES_CBC_SHA");
2a9601315dfc Revision: v2.1.22
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
   984
        return KTls_09();
2a9601315dfc Revision: v2.1.22
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
   985
    case 0x0A:
2a9601315dfc Revision: v2.1.22
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
   986
        _LIT8(KTls_0A, "TLS_RSA_WITH_3DES_EDE_CBC_SHA");
2a9601315dfc Revision: v2.1.22
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
   987
        return KTls_0A();
2a9601315dfc Revision: v2.1.22
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
   988
    case 0x11:
2a9601315dfc Revision: v2.1.22
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
   989
        _LIT8(KTls_11, "TLS_DHE_DSS_EXPORT_WITH_DES40_CBC_SHA");
2a9601315dfc Revision: v2.1.22
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
   990
        return KTls_11();
2a9601315dfc Revision: v2.1.22
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
   991
    case 0x12:
2a9601315dfc Revision: v2.1.22
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
   992
        _LIT8(KTls_12, "TLS_DHE_DSS_WITH_DES_CBC_SHA");
2a9601315dfc Revision: v2.1.22
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
   993
        return KTls_12();
2a9601315dfc Revision: v2.1.22
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
   994
    case 0x13:
2a9601315dfc Revision: v2.1.22
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
   995
        _LIT8(KTls_13, "TLS_DHE_DSS_WITH_3DES_EDE_CBC_SHA");
2a9601315dfc Revision: v2.1.22
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
   996
        return KTls_13();
2a9601315dfc Revision: v2.1.22
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
   997
    case 0x14:
2a9601315dfc Revision: v2.1.22
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
   998
        _LIT8(KTls_14, "TLS_DHE_RSA_EXPORT_WITH_DES40_CBC_SHA");
2a9601315dfc Revision: v2.1.22
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
   999
        return KTls_14();
2a9601315dfc Revision: v2.1.22
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
  1000
    case 0x16:
2a9601315dfc Revision: v2.1.22
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
  1001
        _LIT8(KTls_16, "TLS_DHE_RSA_WITH_3DES_EDE_CBC_SHA");
2a9601315dfc Revision: v2.1.22
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
  1002
        return KTls_16();
2a9601315dfc Revision: v2.1.22
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
  1003
    case 0x19:
2a9601315dfc Revision: v2.1.22
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
  1004
        _LIT8(KTls_19, "TLS_DH_anon_EXPORT_WITH_DES40_CBC_SHA");
2a9601315dfc Revision: v2.1.22
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
  1005
        return KTls_19();
2a9601315dfc Revision: v2.1.22
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
  1006
2a9601315dfc Revision: v2.1.22
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
  1007
// from RFC 3268 : Advanced Encryption Standard (AES) Ciphersuites for Transport Layer Security (TLS)
2a9601315dfc Revision: v2.1.22
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
  1008
    case 0x2F:
2a9601315dfc Revision: v2.1.22
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
  1009
        _LIT8(KTls_2F, "TLS_RSA_WITH_AES_128_CBC_SHA");
2a9601315dfc Revision: v2.1.22
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
  1010
        return KTls_2F();
2a9601315dfc Revision: v2.1.22
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
  1011
    case 0x35:
2a9601315dfc Revision: v2.1.22
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
  1012
        _LIT8(KTls_35, "TLS_RSA_WITH_AES_256_CBC_SHA");
2a9601315dfc Revision: v2.1.22
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
  1013
        return KTls_35();
2a9601315dfc Revision: v2.1.22
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
  1014
    default:
2a9601315dfc Revision: v2.1.22
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
  1015
        return KNullDesC8;
2a9601315dfc Revision: v2.1.22
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
  1016
    }   // end switch
2a9601315dfc Revision: v2.1.22
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
  1017
}
2a9601315dfc Revision: v2.1.22
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
  1018
2a9601315dfc Revision: v2.1.22
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
  1019
void CHttpTransactionClient::StoreOneCookieL(HBufC8*& aRawHeader, RHTTPHeaders aHeaders, TInt aPartIndex, RStringF aFieldName)
2a9601315dfc Revision: v2.1.22
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
  1020
{
2a9601315dfc Revision: v2.1.22
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
  1021
    THTTPHdrVal name, value;
2a9601315dfc Revision: v2.1.22
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
  1022
    RStringPool strP = iTransaction.Session().StringPool();
2a9601315dfc Revision: v2.1.22
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
  1023
2a9601315dfc Revision: v2.1.22
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
  1024
    RStringF cookieName = strP.StringF(HTTP::ECookieName, RHTTPSession::GetTable());
2a9601315dfc Revision: v2.1.22
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
  1025
    RStringF cookieValue= strP.StringF(HTTP::ECookieValue, RHTTPSession::GetTable());
2a9601315dfc Revision: v2.1.22
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
  1026
    RStringF cookiePath= strP.StringF(HTTP::EPath, RHTTPSession::GetTable());
2a9601315dfc Revision: v2.1.22
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
  1027
    RStringF cookieDomain= strP.StringF(HTTP::EDomain, RHTTPSession::GetTable());
2a9601315dfc Revision: v2.1.22
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
  1028
    RStringF cookieMaxAge= strP.StringF(HTTP::EMaxAge, RHTTPSession::GetTable());
2a9601315dfc Revision: v2.1.22
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
  1029
    RStringF cookiePort= strP.StringF(HTTP::ECookiePort, RHTTPSession::GetTable());
2a9601315dfc Revision: v2.1.22
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
  1030
    RStringF cookieComment= strP.StringF(HTTP::EComment, RHTTPSession::GetTable());
2a9601315dfc Revision: v2.1.22
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
  1031
    RStringF cookieCommentURL= strP.StringF(HTTP::ECommentURL, RHTTPSession::GetTable());
2a9601315dfc Revision: v2.1.22
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
  1032
    RStringF cookieSecure= strP.StringF(HTTP::ESecure, RHTTPSession::GetTable());
2a9601315dfc Revision: v2.1.22
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
  1033
    RStringF cookieDiscard= strP.StringF(HTTP::EDiscard, RHTTPSession::GetTable());
2a9601315dfc Revision: v2.1.22
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
  1034
    RStringF cookieVersion= strP.StringF(HTTP::EVersion, RHTTPSession::GetTable());
2a9601315dfc Revision: v2.1.22
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
  1035
    RStringF cookieExpires= strP.StringF(HTTP::EExpires, RHTTPSession::GetTable());
2a9601315dfc Revision: v2.1.22
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
  1036
2a9601315dfc Revision: v2.1.22
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
  1037
    aHeaders.GetParam(aFieldName, cookieName , name, aPartIndex);
2a9601315dfc Revision: v2.1.22
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
  1038
    aHeaders.GetParam(aFieldName, cookieValue, value, aPartIndex);
2a9601315dfc Revision: v2.1.22
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
  1039
2a9601315dfc Revision: v2.1.22
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
  1040
    TInt len1 = name.Str().DesC().Length();
2a9601315dfc Revision: v2.1.22
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
  1041
    TInt len2 = value.Str().DesC().Length();
2a9601315dfc Revision: v2.1.22
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
  1042
    HBufC8* temp = HBufC8::NewLC(KCookieBufferAllocLength);
2a9601315dfc Revision: v2.1.22
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
  1043
    if (((temp->Des().Length()+1+len1+len2)) <(KCookieBufferAllocLength-iMinLength))
2a9601315dfc Revision: v2.1.22
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
  1044
    {
2a9601315dfc Revision: v2.1.22
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
  1045
        temp->Des().Append(name.Str().DesC());
2a9601315dfc Revision: v2.1.22
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
  1046
        temp->Des().Append(KEquals);
2a9601315dfc Revision: v2.1.22
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
  1047
        temp->Des().Append(value.Str().DesC());
2a9601315dfc Revision: v2.1.22
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
  1048
        temp->Des().Append(KSemiColonSpace);
2a9601315dfc Revision: v2.1.22
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
  1049
    }
2a9601315dfc Revision: v2.1.22
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
  1050
    else
2a9601315dfc Revision: v2.1.22
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
  1051
    {
2a9601315dfc Revision: v2.1.22
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
  1052
        iDiscardCookie = true;
2a9601315dfc Revision: v2.1.22
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
  1053
    }
2a9601315dfc Revision: v2.1.22
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
  1054
2a9601315dfc Revision: v2.1.22
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
  1055
    THTTPHdrVal hdrVal;
2a9601315dfc Revision: v2.1.22
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
  1056
2a9601315dfc Revision: v2.1.22
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
  1057
    if (aHeaders.GetParam(aFieldName, cookieComment, hdrVal, aPartIndex) == KErrNone)
2a9601315dfc Revision: v2.1.22
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
  1058
        AddParam(temp, cookieComment.DesC(), hdrVal.StrF().DesC());
2a9601315dfc Revision: v2.1.22
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
  1059
2a9601315dfc Revision: v2.1.22
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
  1060
    if (aHeaders.GetParam(aFieldName, cookieCommentURL, hdrVal, aPartIndex) == KErrNone)
2a9601315dfc Revision: v2.1.22
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
  1061
        AddParam(temp, cookieCommentURL.DesC(), hdrVal.StrF().DesC());
2a9601315dfc Revision: v2.1.22
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
  1062
2a9601315dfc Revision: v2.1.22
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
  1063
    if (aHeaders.GetParam(aFieldName, cookieDiscard, hdrVal, aPartIndex) == KErrNone)
2a9601315dfc Revision: v2.1.22
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
  1064
        AddParam(temp, cookieDiscard.DesC(), hdrVal.StrF().DesC());
2a9601315dfc Revision: v2.1.22
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
  1065
2a9601315dfc Revision: v2.1.22
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
  1066
    if (aHeaders.GetParam(aFieldName, cookieDomain, hdrVal, aPartIndex) == KErrNone)
2a9601315dfc Revision: v2.1.22
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
  1067
        AddParam(temp, cookieDomain.DesC(), hdrVal.StrF().DesC());
2a9601315dfc Revision: v2.1.22
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
  1068
2a9601315dfc Revision: v2.1.22
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
  1069
    if (aHeaders.GetParam(aFieldName, cookieMaxAge, hdrVal, aPartIndex) == KErrNone)
2a9601315dfc Revision: v2.1.22
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
  1070
        AddParam(temp, cookieMaxAge.DesC(), hdrVal.StrF().DesC());
2a9601315dfc Revision: v2.1.22
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
  1071
2a9601315dfc Revision: v2.1.22
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
  1072
    if (aHeaders.GetParam(aFieldName, cookiePath, hdrVal, aPartIndex) == KErrNone)
2a9601315dfc Revision: v2.1.22
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
  1073
        AddParam(temp, cookiePath.DesC(), hdrVal.StrF().DesC());
2a9601315dfc Revision: v2.1.22
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
  1074
2a9601315dfc Revision: v2.1.22
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
  1075
    if (aHeaders.GetParam(aFieldName, cookiePort, hdrVal, aPartIndex) == KErrNone)
2a9601315dfc Revision: v2.1.22
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
  1076
        AddParam(temp, cookiePort.DesC(), hdrVal.StrF().DesC());
2a9601315dfc Revision: v2.1.22
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
  1077
2a9601315dfc Revision: v2.1.22
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
  1078
    if (aHeaders.GetParam(aFieldName, cookieSecure, hdrVal, aPartIndex) == KErrNone)
2a9601315dfc Revision: v2.1.22
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
  1079
        AddParam(temp, cookieSecure.DesC(), hdrVal.StrF().DesC());
2a9601315dfc Revision: v2.1.22
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
  1080
2a9601315dfc Revision: v2.1.22
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
  1081
    if (aHeaders.GetParam(aFieldName, cookieVersion, hdrVal, aPartIndex) == KErrNone)
2a9601315dfc Revision: v2.1.22
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
  1082
        AddParam(temp, cookieVersion.DesC(), hdrVal.StrF().DesC());
2a9601315dfc Revision: v2.1.22
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
  1083
2a9601315dfc Revision: v2.1.22
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
  1084
    if (aHeaders.GetParam(aFieldName, cookieExpires, hdrVal, aPartIndex) == KErrNone)
2a9601315dfc Revision: v2.1.22
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
  1085
        AddParam(temp, cookieExpires.DesC(), hdrVal.StrF().DesC());
2a9601315dfc Revision: v2.1.22
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
  1086
2a9601315dfc Revision: v2.1.22
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
  1087
// If the cookie size is more than 4K, the cookie is discarded
2a9601315dfc Revision: v2.1.22
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
  1088
    if (iDiscardCookie != true)
2a9601315dfc Revision: v2.1.22
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
  1089
        aRawHeader->Des().Append(*temp);
2a9601315dfc Revision: v2.1.22
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
  1090
2a9601315dfc Revision: v2.1.22
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
  1091
    CleanupStack::PopAndDestroy(temp);
2a9601315dfc Revision: v2.1.22
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
  1092
}
2a9601315dfc Revision: v2.1.22
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
  1093
2a9601315dfc Revision: v2.1.22
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
  1094
void CHttpTransactionClient::AddParam(HBufC8*& aTemp, const TDesC8& aName, const TDesC8& aValue)
2a9601315dfc Revision: v2.1.22
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
  1095
{
2a9601315dfc Revision: v2.1.22
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
  1096
    TInt len = aName.Length()+aValue.Length();
2a9601315dfc Revision: v2.1.22
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
  1097
    if ((aTemp->Des().Length()+len+1) < (KCookieBufferAllocLength - iMinLength))
2a9601315dfc Revision: v2.1.22
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
  1098
    {
2a9601315dfc Revision: v2.1.22
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
  1099
        aTemp->Des().Append(aName);
2a9601315dfc Revision: v2.1.22
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
  1100
        aTemp->Des().Append(KEquals);
2a9601315dfc Revision: v2.1.22
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
  1101
        aTemp->Des().Append(aValue);
2a9601315dfc Revision: v2.1.22
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
  1102
        aTemp->Des().Append(KSemiColonSpace);
2a9601315dfc Revision: v2.1.22
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
  1103
    }
2a9601315dfc Revision: v2.1.22
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
  1104
    else
2a9601315dfc Revision: v2.1.22
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
  1105
    {
2a9601315dfc Revision: v2.1.22
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
  1106
        iDiscardCookie = true;
2a9601315dfc Revision: v2.1.22
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
  1107
    }
2a9601315dfc Revision: v2.1.22
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
  1108
}