engine/inc/HttpEventHandler.h
author skip
Thu, 25 Feb 2010 14:29:19 +0000
changeset 2 29cda98b007e
child 117 c2a99fe1afd0
permissions -rw-r--r--
Initial import of Podcatcher from the Bergamot project
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
2
29cda98b007e Initial import of Podcatcher from the Bergamot project
skip
parents:
diff changeset
     1
/*
29cda98b007e Initial import of Podcatcher from the Bergamot project
skip
parents:
diff changeset
     2
* Copyright (c) 2007-2010 Sebastian Brannstrom, Lars Persson, EmbedDev AB
29cda98b007e Initial import of Podcatcher from the Bergamot project
skip
parents:
diff changeset
     3
*
29cda98b007e Initial import of Podcatcher from the Bergamot project
skip
parents:
diff changeset
     4
* All rights reserved.
29cda98b007e Initial import of Podcatcher from the Bergamot project
skip
parents:
diff changeset
     5
* This component and the accompanying materials are made available
29cda98b007e Initial import of Podcatcher from the Bergamot project
skip
parents:
diff changeset
     6
* under the terms of the License "Eclipse Public License v1.0"
29cda98b007e Initial import of Podcatcher from the Bergamot project
skip
parents:
diff changeset
     7
* which accompanies this distribution, and is available
29cda98b007e Initial import of Podcatcher from the Bergamot project
skip
parents:
diff changeset
     8
* at the URL "http://www.eclipse.org/legal/epl-v10.html".
29cda98b007e Initial import of Podcatcher from the Bergamot project
skip
parents:
diff changeset
     9
*
29cda98b007e Initial import of Podcatcher from the Bergamot project
skip
parents:
diff changeset
    10
* Initial Contributors:
29cda98b007e Initial import of Podcatcher from the Bergamot project
skip
parents:
diff changeset
    11
* EmbedDev AB - initial contribution.
29cda98b007e Initial import of Podcatcher from the Bergamot project
skip
parents:
diff changeset
    12
*
29cda98b007e Initial import of Podcatcher from the Bergamot project
skip
parents:
diff changeset
    13
* Contributors:
29cda98b007e Initial import of Podcatcher from the Bergamot project
skip
parents:
diff changeset
    14
*
29cda98b007e Initial import of Podcatcher from the Bergamot project
skip
parents:
diff changeset
    15
* Description:
29cda98b007e Initial import of Podcatcher from the Bergamot project
skip
parents:
diff changeset
    16
*
29cda98b007e Initial import of Podcatcher from the Bergamot project
skip
parents:
diff changeset
    17
*/
29cda98b007e Initial import of Podcatcher from the Bergamot project
skip
parents:
diff changeset
    18
29cda98b007e Initial import of Podcatcher from the Bergamot project
skip
parents:
diff changeset
    19
#ifndef HTTPEVENTHANDLER_H
29cda98b007e Initial import of Podcatcher from the Bergamot project
skip
parents:
diff changeset
    20
#define HTTPEVENTHANDLER_H
29cda98b007e Initial import of Podcatcher from the Bergamot project
skip
parents:
diff changeset
    21
29cda98b007e Initial import of Podcatcher from the Bergamot project
skip
parents:
diff changeset
    22
#include <e32base.h>
29cda98b007e Initial import of Podcatcher from the Bergamot project
skip
parents:
diff changeset
    23
#include <http/mhttpdatasupplier.h>
29cda98b007e Initial import of Podcatcher from the Bergamot project
skip
parents:
diff changeset
    24
#include <http/rhttpsession.h>
29cda98b007e Initial import of Podcatcher from the Bergamot project
skip
parents:
diff changeset
    25
#include <http/rhttpheaders.h>
29cda98b007e Initial import of Podcatcher from the Bergamot project
skip
parents:
diff changeset
    26
#include <http/mhttptransactioncallback.h>
29cda98b007e Initial import of Podcatcher from the Bergamot project
skip
parents:
diff changeset
    27
#include <httpstringconstants.h>
29cda98b007e Initial import of Podcatcher from the Bergamot project
skip
parents:
diff changeset
    28
#include "HttpClientObserver.h"
29cda98b007e Initial import of Podcatcher from the Bergamot project
skip
parents:
diff changeset
    29
29cda98b007e Initial import of Podcatcher from the Bergamot project
skip
parents:
diff changeset
    30
const TInt KMaxSubmitSize = 1024;
29cda98b007e Initial import of Podcatcher from the Bergamot project
skip
parents:
diff changeset
    31
const TInt KMaxHeaderNameLen = 32;
29cda98b007e Initial import of Podcatcher from the Bergamot project
skip
parents:
diff changeset
    32
const TInt KMaxHeaderValueLen = 128;
29cda98b007e Initial import of Podcatcher from the Bergamot project
skip
parents:
diff changeset
    33
const TInt KByteOverlap = 4096;
29cda98b007e Initial import of Podcatcher from the Bergamot project
skip
parents:
diff changeset
    34
29cda98b007e Initial import of Podcatcher from the Bergamot project
skip
parents:
diff changeset
    35
class CHttpEventHandler : public CBase,
29cda98b007e Initial import of Podcatcher from the Bergamot project
skip
parents:
diff changeset
    36
                          public MHTTPTransactionCallback
29cda98b007e Initial import of Podcatcher from the Bergamot project
skip
parents:
diff changeset
    37
  {
29cda98b007e Initial import of Podcatcher from the Bergamot project
skip
parents:
diff changeset
    38
  public:
29cda98b007e Initial import of Podcatcher from the Bergamot project
skip
parents:
diff changeset
    39
	virtual ~CHttpEventHandler();
29cda98b007e Initial import of Podcatcher from the Bergamot project
skip
parents:
diff changeset
    40
	static CHttpEventHandler* NewLC(CHttpClient* aClient, MHttpClientObserver &aCallbacks, RFs& aFs);
29cda98b007e Initial import of Podcatcher from the Bergamot project
skip
parents:
diff changeset
    41
	static CHttpEventHandler* NewL(CHttpClient* aClient, MHttpClientObserver &aCallbacks, RFs& aFs);
29cda98b007e Initial import of Podcatcher from the Bergamot project
skip
parents:
diff changeset
    42
	void SetSaveFileName(const TDesC &fName,TBool aContinue=EFalse);
29cda98b007e Initial import of Podcatcher from the Bergamot project
skip
parents:
diff changeset
    43
	void CloseSaveFile();	
29cda98b007e Initial import of Podcatcher from the Bergamot project
skip
parents:
diff changeset
    44
	// from MHTTPTransactionCallback
29cda98b007e Initial import of Podcatcher from the Bergamot project
skip
parents:
diff changeset
    45
	virtual void MHFRunL(RHTTPTransaction aTransaction, const THTTPEvent& aEvent);
29cda98b007e Initial import of Podcatcher from the Bergamot project
skip
parents:
diff changeset
    46
	virtual TInt MHFRunError(TInt aError, RHTTPTransaction aTransaction, const THTTPEvent& aEvent);
29cda98b007e Initial import of Podcatcher from the Bergamot project
skip
parents:
diff changeset
    47
	void SetSilent(TBool aSilent);
29cda98b007e Initial import of Podcatcher from the Bergamot project
skip
parents:
diff changeset
    48
29cda98b007e Initial import of Podcatcher from the Bergamot project
skip
parents:
diff changeset
    49
	
29cda98b007e Initial import of Podcatcher from the Bergamot project
skip
parents:
diff changeset
    50
protected:
29cda98b007e Initial import of Podcatcher from the Bergamot project
skip
parents:
diff changeset
    51
	CHttpEventHandler(CHttpClient* aClient, MHttpClientObserver &aCallbacks, RFs& aFs);
29cda98b007e Initial import of Podcatcher from the Bergamot project
skip
parents:
diff changeset
    52
	void ConstructL();
29cda98b007e Initial import of Podcatcher from the Bergamot project
skip
parents:
diff changeset
    53
	
29cda98b007e Initial import of Podcatcher from the Bergamot project
skip
parents:
diff changeset
    54
private:
29cda98b007e Initial import of Podcatcher from the Bergamot project
skip
parents:
diff changeset
    55
	void DumpRespHeadersL(RHTTPTransaction& aTrans);
29cda98b007e Initial import of Podcatcher from the Bergamot project
skip
parents:
diff changeset
    56
	void DumpRespBody(RHTTPTransaction& aTrans);
29cda98b007e Initial import of Podcatcher from the Bergamot project
skip
parents:
diff changeset
    57
	void DumpIt(const TDesC8& aData);
29cda98b007e Initial import of Podcatcher from the Bergamot project
skip
parents:
diff changeset
    58
29cda98b007e Initial import of Podcatcher from the Bergamot project
skip
parents:
diff changeset
    59
private:
29cda98b007e Initial import of Podcatcher from the Bergamot project
skip
parents:
diff changeset
    60
	TBool iVerbose;
29cda98b007e Initial import of Podcatcher from the Bergamot project
skip
parents:
diff changeset
    61
	TBool iSavingResponseBody;
29cda98b007e Initial import of Podcatcher from the Bergamot project
skip
parents:
diff changeset
    62
	RFs& iFileServ;
29cda98b007e Initial import of Podcatcher from the Bergamot project
skip
parents:
diff changeset
    63
	RFile iRespBodyFile;
29cda98b007e Initial import of Podcatcher from the Bergamot project
skip
parents:
diff changeset
    64
	TFileName iFileName;
29cda98b007e Initial import of Podcatcher from the Bergamot project
skip
parents:
diff changeset
    65
	TParse iParsedFileName;
29cda98b007e Initial import of Podcatcher from the Bergamot project
skip
parents:
diff changeset
    66
	MHTTPDataSupplier* iRespBody;	
29cda98b007e Initial import of Podcatcher from the Bergamot project
skip
parents:
diff changeset
    67
	TInt iBytesDownloaded;
29cda98b007e Initial import of Podcatcher from the Bergamot project
skip
parents:
diff changeset
    68
	TInt iBytesTotal;
29cda98b007e Initial import of Podcatcher from the Bergamot project
skip
parents:
diff changeset
    69
	CHttpClient* iHttpClient;
29cda98b007e Initial import of Podcatcher from the Bergamot project
skip
parents:
diff changeset
    70
	MHttpClientObserver& iCallbacks;
29cda98b007e Initial import of Podcatcher from the Bergamot project
skip
parents:
diff changeset
    71
	TBool iSilent;
29cda98b007e Initial import of Podcatcher from the Bergamot project
skip
parents:
diff changeset
    72
	TBool iContinue;
29cda98b007e Initial import of Podcatcher from the Bergamot project
skip
parents:
diff changeset
    73
	TInt iLastStatusCode;
29cda98b007e Initial import of Podcatcher from the Bergamot project
skip
parents:
diff changeset
    74
};
29cda98b007e Initial import of Podcatcher from the Bergamot project
skip
parents:
diff changeset
    75
29cda98b007e Initial import of Podcatcher from the Bergamot project
skip
parents:
diff changeset
    76
#endif