calendarengines/caldav/src/httpclient.cpp
author Maximilian Odendahl <maximilian.odendahl@sun.com>
Fri, 05 Feb 2010 10:16:42 +0100
changeset 1 4927282092b4
child 6 5a04f2ceabfe
permissions -rw-r--r--
Bug 208: inital CalDAV support for Symbian
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
1
4927282092b4 Bug 208: inital CalDAV support for Symbian
Maximilian Odendahl <maximilian.odendahl@sun.com>
parents:
diff changeset
     1
/*
4927282092b4 Bug 208: inital CalDAV support for Symbian
Maximilian Odendahl <maximilian.odendahl@sun.com>
parents:
diff changeset
     2
* Copyright (c) 2010 Sun Microsystems, Inc. and/or its subsidiary(-ies).
4927282092b4 Bug 208: inital CalDAV support for Symbian
Maximilian Odendahl <maximilian.odendahl@sun.com>
parents:
diff changeset
     3
* All rights reserved.
4927282092b4 Bug 208: inital CalDAV support for Symbian
Maximilian Odendahl <maximilian.odendahl@sun.com>
parents:
diff changeset
     4
* This component and the accompanying materials are made available
4927282092b4 Bug 208: inital CalDAV support for Symbian
Maximilian Odendahl <maximilian.odendahl@sun.com>
parents:
diff changeset
     5
* under the terms of "Eclipse Public License v1.0"
4927282092b4 Bug 208: inital CalDAV support for Symbian
Maximilian Odendahl <maximilian.odendahl@sun.com>
parents:
diff changeset
     6
* which accompanies this distribution, and is available
4927282092b4 Bug 208: inital CalDAV support for Symbian
Maximilian Odendahl <maximilian.odendahl@sun.com>
parents:
diff changeset
     7
* at the URL "http://www.eclipse.org/legal/epl-v10.html".
4927282092b4 Bug 208: inital CalDAV support for Symbian
Maximilian Odendahl <maximilian.odendahl@sun.com>
parents:
diff changeset
     8
*
4927282092b4 Bug 208: inital CalDAV support for Symbian
Maximilian Odendahl <maximilian.odendahl@sun.com>
parents:
diff changeset
     9
* Initial Contributor:
4927282092b4 Bug 208: inital CalDAV support for Symbian
Maximilian Odendahl <maximilian.odendahl@sun.com>
parents:
diff changeset
    10
* Maximilian Odendahl
4927282092b4 Bug 208: inital CalDAV support for Symbian
Maximilian Odendahl <maximilian.odendahl@sun.com>
parents:
diff changeset
    11
*
4927282092b4 Bug 208: inital CalDAV support for Symbian
Maximilian Odendahl <maximilian.odendahl@sun.com>
parents:
diff changeset
    12
* Contributors:
4927282092b4 Bug 208: inital CalDAV support for Symbian
Maximilian Odendahl <maximilian.odendahl@sun.com>
parents:
diff changeset
    13
* 
4927282092b4 Bug 208: inital CalDAV support for Symbian
Maximilian Odendahl <maximilian.odendahl@sun.com>
parents:
diff changeset
    14
* Description: 	basic http/webdav functionality
4927282092b4 Bug 208: inital CalDAV support for Symbian
Maximilian Odendahl <maximilian.odendahl@sun.com>
parents:
diff changeset
    15
*				handles all needed internet access for Caldav
4927282092b4 Bug 208: inital CalDAV support for Symbian
Maximilian Odendahl <maximilian.odendahl@sun.com>
parents:
diff changeset
    16
*/
4927282092b4 Bug 208: inital CalDAV support for Symbian
Maximilian Odendahl <maximilian.odendahl@sun.com>
parents:
diff changeset
    17
4927282092b4 Bug 208: inital CalDAV support for Symbian
Maximilian Odendahl <maximilian.odendahl@sun.com>
parents:
diff changeset
    18
#include "httpclient.h"
4927282092b4 Bug 208: inital CalDAV support for Symbian
Maximilian Odendahl <maximilian.odendahl@sun.com>
parents:
diff changeset
    19
#include "caldavutils.h"
4927282092b4 Bug 208: inital CalDAV support for Symbian
Maximilian Odendahl <maximilian.odendahl@sun.com>
parents:
diff changeset
    20
#include <uri8.h>
4927282092b4 Bug 208: inital CalDAV support for Symbian
Maximilian Odendahl <maximilian.odendahl@sun.com>
parents:
diff changeset
    21
#include <http.h>
4927282092b4 Bug 208: inital CalDAV support for Symbian
Maximilian Odendahl <maximilian.odendahl@sun.com>
parents:
diff changeset
    22
#include <EIKENV.H>
4927282092b4 Bug 208: inital CalDAV support for Symbian
Maximilian Odendahl <maximilian.odendahl@sun.com>
parents:
diff changeset
    23
4927282092b4 Bug 208: inital CalDAV support for Symbian
Maximilian Odendahl <maximilian.odendahl@sun.com>
parents:
diff changeset
    24
_LIT8(KTextXml,"text/xml");
4927282092b4 Bug 208: inital CalDAV support for Symbian
Maximilian Odendahl <maximilian.odendahl@sun.com>
parents:
diff changeset
    25
_LIT8(KTextCalendar,"text/calendar");
4927282092b4 Bug 208: inital CalDAV support for Symbian
Maximilian Odendahl <maximilian.odendahl@sun.com>
parents:
diff changeset
    26
_LIT8(KDepth,"depth");
4927282092b4 Bug 208: inital CalDAV support for Symbian
Maximilian Odendahl <maximilian.odendahl@sun.com>
parents:
diff changeset
    27
4927282092b4 Bug 208: inital CalDAV support for Symbian
Maximilian Odendahl <maximilian.odendahl@sun.com>
parents:
diff changeset
    28
/**
4927282092b4 Bug 208: inital CalDAV support for Symbian
Maximilian Odendahl <maximilian.odendahl@sun.com>
parents:
diff changeset
    29
 * CHttpClient::CHttpClient
4927282092b4 Bug 208: inital CalDAV support for Symbian
Maximilian Odendahl <maximilian.odendahl@sun.com>
parents:
diff changeset
    30
 * default constructor
4927282092b4 Bug 208: inital CalDAV support for Symbian
Maximilian Odendahl <maximilian.odendahl@sun.com>
parents:
diff changeset
    31
 */
4927282092b4 Bug 208: inital CalDAV support for Symbian
Maximilian Odendahl <maximilian.odendahl@sun.com>
parents:
diff changeset
    32
CHttpClient::CHttpClient() :
4927282092b4 Bug 208: inital CalDAV support for Symbian
Maximilian Odendahl <maximilian.odendahl@sun.com>
parents:
diff changeset
    33
	iUser(0), iPassword(0), iEtag(0), iCredentialCount(0)
4927282092b4 Bug 208: inital CalDAV support for Symbian
Maximilian Odendahl <maximilian.odendahl@sun.com>
parents:
diff changeset
    34
	{
4927282092b4 Bug 208: inital CalDAV support for Symbian
Maximilian Odendahl <maximilian.odendahl@sun.com>
parents:
diff changeset
    35
	}
4927282092b4 Bug 208: inital CalDAV support for Symbian
Maximilian Odendahl <maximilian.odendahl@sun.com>
parents:
diff changeset
    36
4927282092b4 Bug 208: inital CalDAV support for Symbian
Maximilian Odendahl <maximilian.odendahl@sun.com>
parents:
diff changeset
    37
/**
4927282092b4 Bug 208: inital CalDAV support for Symbian
Maximilian Odendahl <maximilian.odendahl@sun.com>
parents:
diff changeset
    38
 * CHttpClient::~CHttpClient
4927282092b4 Bug 208: inital CalDAV support for Symbian
Maximilian Odendahl <maximilian.odendahl@sun.com>
parents:
diff changeset
    39
 * default destructor
4927282092b4 Bug 208: inital CalDAV support for Symbian
Maximilian Odendahl <maximilian.odendahl@sun.com>
parents:
diff changeset
    40
 */
4927282092b4 Bug 208: inital CalDAV support for Symbian
Maximilian Odendahl <maximilian.odendahl@sun.com>
parents:
diff changeset
    41
CHttpClient::~CHttpClient()
4927282092b4 Bug 208: inital CalDAV support for Symbian
Maximilian Odendahl <maximilian.odendahl@sun.com>
parents:
diff changeset
    42
	{
4927282092b4 Bug 208: inital CalDAV support for Symbian
Maximilian Odendahl <maximilian.odendahl@sun.com>
parents:
diff changeset
    43
	delete iUser;
4927282092b4 Bug 208: inital CalDAV support for Symbian
Maximilian Odendahl <maximilian.odendahl@sun.com>
parents:
diff changeset
    44
	delete iPassword;
4927282092b4 Bug 208: inital CalDAV support for Symbian
Maximilian Odendahl <maximilian.odendahl@sun.com>
parents:
diff changeset
    45
	delete iEtag;
4927282092b4 Bug 208: inital CalDAV support for Symbian
Maximilian Odendahl <maximilian.odendahl@sun.com>
parents:
diff changeset
    46
4927282092b4 Bug 208: inital CalDAV support for Symbian
Maximilian Odendahl <maximilian.odendahl@sun.com>
parents:
diff changeset
    47
	iSess.Close();
4927282092b4 Bug 208: inital CalDAV support for Symbian
Maximilian Odendahl <maximilian.odendahl@sun.com>
parents:
diff changeset
    48
	iRConnection.Close();
4927282092b4 Bug 208: inital CalDAV support for Symbian
Maximilian Odendahl <maximilian.odendahl@sun.com>
parents:
diff changeset
    49
	iSocketServ.Close();
4927282092b4 Bug 208: inital CalDAV support for Symbian
Maximilian Odendahl <maximilian.odendahl@sun.com>
parents:
diff changeset
    50
4927282092b4 Bug 208: inital CalDAV support for Symbian
Maximilian Odendahl <maximilian.odendahl@sun.com>
parents:
diff changeset
    51
	}
4927282092b4 Bug 208: inital CalDAV support for Symbian
Maximilian Odendahl <maximilian.odendahl@sun.com>
parents:
diff changeset
    52
4927282092b4 Bug 208: inital CalDAV support for Symbian
Maximilian Odendahl <maximilian.odendahl@sun.com>
parents:
diff changeset
    53
/**
4927282092b4 Bug 208: inital CalDAV support for Symbian
Maximilian Odendahl <maximilian.odendahl@sun.com>
parents:
diff changeset
    54
 * CHttpClient::NewLC
4927282092b4 Bug 208: inital CalDAV support for Symbian
Maximilian Odendahl <maximilian.odendahl@sun.com>
parents:
diff changeset
    55
 * first phase constructor
4927282092b4 Bug 208: inital CalDAV support for Symbian
Maximilian Odendahl <maximilian.odendahl@sun.com>
parents:
diff changeset
    56
 */
4927282092b4 Bug 208: inital CalDAV support for Symbian
Maximilian Odendahl <maximilian.odendahl@sun.com>
parents:
diff changeset
    57
CHttpClient* CHttpClient::NewLC()
4927282092b4 Bug 208: inital CalDAV support for Symbian
Maximilian Odendahl <maximilian.odendahl@sun.com>
parents:
diff changeset
    58
	{
4927282092b4 Bug 208: inital CalDAV support for Symbian
Maximilian Odendahl <maximilian.odendahl@sun.com>
parents:
diff changeset
    59
	CHttpClient* me = new (ELeave) CHttpClient;
4927282092b4 Bug 208: inital CalDAV support for Symbian
Maximilian Odendahl <maximilian.odendahl@sun.com>
parents:
diff changeset
    60
	CleanupStack::PushL(me);
4927282092b4 Bug 208: inital CalDAV support for Symbian
Maximilian Odendahl <maximilian.odendahl@sun.com>
parents:
diff changeset
    61
	me->ConstructL();
4927282092b4 Bug 208: inital CalDAV support for Symbian
Maximilian Odendahl <maximilian.odendahl@sun.com>
parents:
diff changeset
    62
	return me;
4927282092b4 Bug 208: inital CalDAV support for Symbian
Maximilian Odendahl <maximilian.odendahl@sun.com>
parents:
diff changeset
    63
	}
4927282092b4 Bug 208: inital CalDAV support for Symbian
Maximilian Odendahl <maximilian.odendahl@sun.com>
parents:
diff changeset
    64
4927282092b4 Bug 208: inital CalDAV support for Symbian
Maximilian Odendahl <maximilian.odendahl@sun.com>
parents:
diff changeset
    65
/**
4927282092b4 Bug 208: inital CalDAV support for Symbian
Maximilian Odendahl <maximilian.odendahl@sun.com>
parents:
diff changeset
    66
 * CHttpClient::NewL
4927282092b4 Bug 208: inital CalDAV support for Symbian
Maximilian Odendahl <maximilian.odendahl@sun.com>
parents:
diff changeset
    67
 * first phase construction
4927282092b4 Bug 208: inital CalDAV support for Symbian
Maximilian Odendahl <maximilian.odendahl@sun.com>
parents:
diff changeset
    68
 */
4927282092b4 Bug 208: inital CalDAV support for Symbian
Maximilian Odendahl <maximilian.odendahl@sun.com>
parents:
diff changeset
    69
CHttpClient* CHttpClient::NewL()
4927282092b4 Bug 208: inital CalDAV support for Symbian
Maximilian Odendahl <maximilian.odendahl@sun.com>
parents:
diff changeset
    70
	{
4927282092b4 Bug 208: inital CalDAV support for Symbian
Maximilian Odendahl <maximilian.odendahl@sun.com>
parents:
diff changeset
    71
	CHttpClient* me = NewLC();
4927282092b4 Bug 208: inital CalDAV support for Symbian
Maximilian Odendahl <maximilian.odendahl@sun.com>
parents:
diff changeset
    72
	CleanupStack::Pop(me);
4927282092b4 Bug 208: inital CalDAV support for Symbian
Maximilian Odendahl <maximilian.odendahl@sun.com>
parents:
diff changeset
    73
	return me;
4927282092b4 Bug 208: inital CalDAV support for Symbian
Maximilian Odendahl <maximilian.odendahl@sun.com>
parents:
diff changeset
    74
	}
4927282092b4 Bug 208: inital CalDAV support for Symbian
Maximilian Odendahl <maximilian.odendahl@sun.com>
parents:
diff changeset
    75
4927282092b4 Bug 208: inital CalDAV support for Symbian
Maximilian Odendahl <maximilian.odendahl@sun.com>
parents:
diff changeset
    76
/**
4927282092b4 Bug 208: inital CalDAV support for Symbian
Maximilian Odendahl <maximilian.odendahl@sun.com>
parents:
diff changeset
    77
 * CHttpClient::OpenSessionL
4927282092b4 Bug 208: inital CalDAV support for Symbian
Maximilian Odendahl <maximilian.odendahl@sun.com>
parents:
diff changeset
    78
 * open session and instal authentification
4927282092b4 Bug 208: inital CalDAV support for Symbian
Maximilian Odendahl <maximilian.odendahl@sun.com>
parents:
diff changeset
    79
 */
4927282092b4 Bug 208: inital CalDAV support for Symbian
Maximilian Odendahl <maximilian.odendahl@sun.com>
parents:
diff changeset
    80
void CHttpClient::OpenSessionL()
4927282092b4 Bug 208: inital CalDAV support for Symbian
Maximilian Odendahl <maximilian.odendahl@sun.com>
parents:
diff changeset
    81
	{
4927282092b4 Bug 208: inital CalDAV support for Symbian
Maximilian Odendahl <maximilian.odendahl@sun.com>
parents:
diff changeset
    82
	TRAPD(err, iSess.OpenL());
4927282092b4 Bug 208: inital CalDAV support for Symbian
Maximilian Odendahl <maximilian.odendahl@sun.com>
parents:
diff changeset
    83
4927282092b4 Bug 208: inital CalDAV support for Symbian
Maximilian Odendahl <maximilian.odendahl@sun.com>
parents:
diff changeset
    84
	if (err != KErrNone)
4927282092b4 Bug 208: inital CalDAV support for Symbian
Maximilian Odendahl <maximilian.odendahl@sun.com>
parents:
diff changeset
    85
		{
4927282092b4 Bug 208: inital CalDAV support for Symbian
Maximilian Odendahl <maximilian.odendahl@sun.com>
parents:
diff changeset
    86
		_LIT(KErrMsg, "Cannot create session. Is internet access point configured?");
4927282092b4 Bug 208: inital CalDAV support for Symbian
Maximilian Odendahl <maximilian.odendahl@sun.com>
parents:
diff changeset
    87
		_LIT(KExitingApp, "Exiting app.");
4927282092b4 Bug 208: inital CalDAV support for Symbian
Maximilian Odendahl <maximilian.odendahl@sun.com>
parents:
diff changeset
    88
		CEikonEnv::Static()->InfoWinL(KErrMsg, KExitingApp);
4927282092b4 Bug 208: inital CalDAV support for Symbian
Maximilian Odendahl <maximilian.odendahl@sun.com>
parents:
diff changeset
    89
		User::Leave(err);
4927282092b4 Bug 208: inital CalDAV support for Symbian
Maximilian Odendahl <maximilian.odendahl@sun.com>
parents:
diff changeset
    90
		}
4927282092b4 Bug 208: inital CalDAV support for Symbian
Maximilian Odendahl <maximilian.odendahl@sun.com>
parents:
diff changeset
    91
4927282092b4 Bug 208: inital CalDAV support for Symbian
Maximilian Odendahl <maximilian.odendahl@sun.com>
parents:
diff changeset
    92
	// Install this class as the callback for authentication requests
4927282092b4 Bug 208: inital CalDAV support for Symbian
Maximilian Odendahl <maximilian.odendahl@sun.com>
parents:
diff changeset
    93
	InstallAuthenticationL(iSess);
4927282092b4 Bug 208: inital CalDAV support for Symbian
Maximilian Odendahl <maximilian.odendahl@sun.com>
parents:
diff changeset
    94
4927282092b4 Bug 208: inital CalDAV support for Symbian
Maximilian Odendahl <maximilian.odendahl@sun.com>
parents:
diff changeset
    95
	// Set the session's connection info...
4927282092b4 Bug 208: inital CalDAV support for Symbian
Maximilian Odendahl <maximilian.odendahl@sun.com>
parents:
diff changeset
    96
	RHTTPConnectionInfo connInfo = iSess.ConnectionInfo();
4927282092b4 Bug 208: inital CalDAV support for Symbian
Maximilian Odendahl <maximilian.odendahl@sun.com>
parents:
diff changeset
    97
	// ...to use the socket server
4927282092b4 Bug 208: inital CalDAV support for Symbian
Maximilian Odendahl <maximilian.odendahl@sun.com>
parents:
diff changeset
    98
	connInfo.SetPropertyL(iSess.StringPool().StringF(HTTP::EHttpSocketServ,
4927282092b4 Bug 208: inital CalDAV support for Symbian
Maximilian Odendahl <maximilian.odendahl@sun.com>
parents:
diff changeset
    99
			RHTTPSession::GetTable()), THTTPHdrVal(iSocketServ.Handle()));
4927282092b4 Bug 208: inital CalDAV support for Symbian
Maximilian Odendahl <maximilian.odendahl@sun.com>
parents:
diff changeset
   100
	// ...to use the connection
4927282092b4 Bug 208: inital CalDAV support for Symbian
Maximilian Odendahl <maximilian.odendahl@sun.com>
parents:
diff changeset
   101
	connInfo.SetPropertyL(
4927282092b4 Bug 208: inital CalDAV support for Symbian
Maximilian Odendahl <maximilian.odendahl@sun.com>
parents:
diff changeset
   102
			iSess.StringPool().StringF(HTTP::EHttpSocketConnection,
4927282092b4 Bug 208: inital CalDAV support for Symbian
Maximilian Odendahl <maximilian.odendahl@sun.com>
parents:
diff changeset
   103
					RHTTPSession::GetTable()),
4927282092b4 Bug 208: inital CalDAV support for Symbian
Maximilian Odendahl <maximilian.odendahl@sun.com>
parents:
diff changeset
   104
			THTTPHdrVal(REINTERPRET_CAST(TInt, &(iRConnection))));
4927282092b4 Bug 208: inital CalDAV support for Symbian
Maximilian Odendahl <maximilian.odendahl@sun.com>
parents:
diff changeset
   105
4927282092b4 Bug 208: inital CalDAV support for Symbian
Maximilian Odendahl <maximilian.odendahl@sun.com>
parents:
diff changeset
   106
	}
4927282092b4 Bug 208: inital CalDAV support for Symbian
Maximilian Odendahl <maximilian.odendahl@sun.com>
parents:
diff changeset
   107
4927282092b4 Bug 208: inital CalDAV support for Symbian
Maximilian Odendahl <maximilian.odendahl@sun.com>
parents:
diff changeset
   108
/**
4927282092b4 Bug 208: inital CalDAV support for Symbian
Maximilian Odendahl <maximilian.odendahl@sun.com>
parents:
diff changeset
   109
 * CHttpClient::ConstructL
4927282092b4 Bug 208: inital CalDAV support for Symbian
Maximilian Odendahl <maximilian.odendahl@sun.com>
parents:
diff changeset
   110
 * second phase construction
4927282092b4 Bug 208: inital CalDAV support for Symbian
Maximilian Odendahl <maximilian.odendahl@sun.com>
parents:
diff changeset
   111
 */
4927282092b4 Bug 208: inital CalDAV support for Symbian
Maximilian Odendahl <maximilian.odendahl@sun.com>
parents:
diff changeset
   112
void CHttpClient::ConstructL()
4927282092b4 Bug 208: inital CalDAV support for Symbian
Maximilian Odendahl <maximilian.odendahl@sun.com>
parents:
diff changeset
   113
	{
4927282092b4 Bug 208: inital CalDAV support for Symbian
Maximilian Odendahl <maximilian.odendahl@sun.com>
parents:
diff changeset
   114
	User::LeaveIfError(iSocketServ.Connect());
4927282092b4 Bug 208: inital CalDAV support for Symbian
Maximilian Odendahl <maximilian.odendahl@sun.com>
parents:
diff changeset
   115
	User::LeaveIfError(iRConnection.Open(iSocketServ));
4927282092b4 Bug 208: inital CalDAV support for Symbian
Maximilian Odendahl <maximilian.odendahl@sun.com>
parents:
diff changeset
   116
	
4927282092b4 Bug 208: inital CalDAV support for Symbian
Maximilian Odendahl <maximilian.odendahl@sun.com>
parents:
diff changeset
   117
	iExtPrefs.SetSnapPurpose( CMManager::ESnapPurposeInternet );
4927282092b4 Bug 208: inital CalDAV support for Symbian
Maximilian Odendahl <maximilian.odendahl@sun.com>
parents:
diff changeset
   118
	iExtPrefs.SetNoteBehaviour( TExtendedConnPref::ENoteBehaviourConnDisableNotes);
4927282092b4 Bug 208: inital CalDAV support for Symbian
Maximilian Odendahl <maximilian.odendahl@sun.com>
parents:
diff changeset
   119
	iPrefList.AppendL(&iExtPrefs);
4927282092b4 Bug 208: inital CalDAV support for Symbian
Maximilian Odendahl <maximilian.odendahl@sun.com>
parents:
diff changeset
   120
	iRConnection.Start(iPrefList);
4927282092b4 Bug 208: inital CalDAV support for Symbian
Maximilian Odendahl <maximilian.odendahl@sun.com>
parents:
diff changeset
   121
4927282092b4 Bug 208: inital CalDAV support for Symbian
Maximilian Odendahl <maximilian.odendahl@sun.com>
parents:
diff changeset
   122
	OpenSessionL();
4927282092b4 Bug 208: inital CalDAV support for Symbian
Maximilian Odendahl <maximilian.odendahl@sun.com>
parents:
diff changeset
   123
	}
4927282092b4 Bug 208: inital CalDAV support for Symbian
Maximilian Odendahl <maximilian.odendahl@sun.com>
parents:
diff changeset
   124
4927282092b4 Bug 208: inital CalDAV support for Symbian
Maximilian Odendahl <maximilian.odendahl@sun.com>
parents:
diff changeset
   125
/**
4927282092b4 Bug 208: inital CalDAV support for Symbian
Maximilian Odendahl <maximilian.odendahl@sun.com>
parents:
diff changeset
   126
 * CHttpClient::DeleteL
4927282092b4 Bug 208: inital CalDAV support for Symbian
Maximilian Odendahl <maximilian.odendahl@sun.com>
parents:
diff changeset
   127
 * HTTP DELETE
4927282092b4 Bug 208: inital CalDAV support for Symbian
Maximilian Odendahl <maximilian.odendahl@sun.com>
parents:
diff changeset
   128
 */
4927282092b4 Bug 208: inital CalDAV support for Symbian
Maximilian Odendahl <maximilian.odendahl@sun.com>
parents:
diff changeset
   129
TInt CHttpClient::DeleteL(const TDesC8 &aUrl, const TDesC8 &aETag)
4927282092b4 Bug 208: inital CalDAV support for Symbian
Maximilian Odendahl <maximilian.odendahl@sun.com>
parents:
diff changeset
   130
	{
4927282092b4 Bug 208: inital CalDAV support for Symbian
Maximilian Odendahl <maximilian.odendahl@sun.com>
parents:
diff changeset
   131
	iReturnCode = ERROR;
4927282092b4 Bug 208: inital CalDAV support for Symbian
Maximilian Odendahl <maximilian.odendahl@sun.com>
parents:
diff changeset
   132
4927282092b4 Bug 208: inital CalDAV support for Symbian
Maximilian Odendahl <maximilian.odendahl@sun.com>
parents:
diff changeset
   133
	TUriParser8 uri;
4927282092b4 Bug 208: inital CalDAV support for Symbian
Maximilian Odendahl <maximilian.odendahl@sun.com>
parents:
diff changeset
   134
	uri.Parse(aUrl);
4927282092b4 Bug 208: inital CalDAV support for Symbian
Maximilian Odendahl <maximilian.odendahl@sun.com>
parents:
diff changeset
   135
4927282092b4 Bug 208: inital CalDAV support for Symbian
Maximilian Odendahl <maximilian.odendahl@sun.com>
parents:
diff changeset
   136
	iTrans = iSess.OpenTransactionL(uri, *this, iSess.StringPool().StringF(
4927282092b4 Bug 208: inital CalDAV support for Symbian
Maximilian Odendahl <maximilian.odendahl@sun.com>
parents:
diff changeset
   137
			HTTP::EDELETE, RHTTPSession::GetTable()));
4927282092b4 Bug 208: inital CalDAV support for Symbian
Maximilian Odendahl <maximilian.odendahl@sun.com>
parents:
diff changeset
   138
	if (aETag != KNullDesC8)
4927282092b4 Bug 208: inital CalDAV support for Symbian
Maximilian Odendahl <maximilian.odendahl@sun.com>
parents:
diff changeset
   139
		SetHeaderL(iTrans.Request().GetHeaderCollection(), HTTP::EIfMatch,
4927282092b4 Bug 208: inital CalDAV support for Symbian
Maximilian Odendahl <maximilian.odendahl@sun.com>
parents:
diff changeset
   140
				aETag);
4927282092b4 Bug 208: inital CalDAV support for Symbian
Maximilian Odendahl <maximilian.odendahl@sun.com>
parents:
diff changeset
   141
	SetHeaderL(iTrans.Request().GetHeaderCollection(), HTTP::EUserAgent,
4927282092b4 Bug 208: inital CalDAV support for Symbian
Maximilian Odendahl <maximilian.odendahl@sun.com>
parents:
diff changeset
   142
			KUserAgent);
4927282092b4 Bug 208: inital CalDAV support for Symbian
Maximilian Odendahl <maximilian.odendahl@sun.com>
parents:
diff changeset
   143
	iTrans.SubmitL();
4927282092b4 Bug 208: inital CalDAV support for Symbian
Maximilian Odendahl <maximilian.odendahl@sun.com>
parents:
diff changeset
   144
4927282092b4 Bug 208: inital CalDAV support for Symbian
Maximilian Odendahl <maximilian.odendahl@sun.com>
parents:
diff changeset
   145
	CActiveScheduler::Start();
4927282092b4 Bug 208: inital CalDAV support for Symbian
Maximilian Odendahl <maximilian.odendahl@sun.com>
parents:
diff changeset
   146
	return iReturnCode;
4927282092b4 Bug 208: inital CalDAV support for Symbian
Maximilian Odendahl <maximilian.odendahl@sun.com>
parents:
diff changeset
   147
	}
4927282092b4 Bug 208: inital CalDAV support for Symbian
Maximilian Odendahl <maximilian.odendahl@sun.com>
parents:
diff changeset
   148
4927282092b4 Bug 208: inital CalDAV support for Symbian
Maximilian Odendahl <maximilian.odendahl@sun.com>
parents:
diff changeset
   149
/**
4927282092b4 Bug 208: inital CalDAV support for Symbian
Maximilian Odendahl <maximilian.odendahl@sun.com>
parents:
diff changeset
   150
 * CHttpClient::HeadL
4927282092b4 Bug 208: inital CalDAV support for Symbian
Maximilian Odendahl <maximilian.odendahl@sun.com>
parents:
diff changeset
   151
 * HTTP HEAD
4927282092b4 Bug 208: inital CalDAV support for Symbian
Maximilian Odendahl <maximilian.odendahl@sun.com>
parents:
diff changeset
   152
 */
4927282092b4 Bug 208: inital CalDAV support for Symbian
Maximilian Odendahl <maximilian.odendahl@sun.com>
parents:
diff changeset
   153
TInt CHttpClient::HeadL(const TDesC8 &aUrl)
4927282092b4 Bug 208: inital CalDAV support for Symbian
Maximilian Odendahl <maximilian.odendahl@sun.com>
parents:
diff changeset
   154
	{
4927282092b4 Bug 208: inital CalDAV support for Symbian
Maximilian Odendahl <maximilian.odendahl@sun.com>
parents:
diff changeset
   155
	iReturnCode = ERROR;
4927282092b4 Bug 208: inital CalDAV support for Symbian
Maximilian Odendahl <maximilian.odendahl@sun.com>
parents:
diff changeset
   156
4927282092b4 Bug 208: inital CalDAV support for Symbian
Maximilian Odendahl <maximilian.odendahl@sun.com>
parents:
diff changeset
   157
	TUriParser8 uri;
4927282092b4 Bug 208: inital CalDAV support for Symbian
Maximilian Odendahl <maximilian.odendahl@sun.com>
parents:
diff changeset
   158
	uri.Parse(aUrl);
4927282092b4 Bug 208: inital CalDAV support for Symbian
Maximilian Odendahl <maximilian.odendahl@sun.com>
parents:
diff changeset
   159
4927282092b4 Bug 208: inital CalDAV support for Symbian
Maximilian Odendahl <maximilian.odendahl@sun.com>
parents:
diff changeset
   160
	iTrans = iSess.OpenTransactionL(uri, *this, iSess.StringPool().StringF(
4927282092b4 Bug 208: inital CalDAV support for Symbian
Maximilian Odendahl <maximilian.odendahl@sun.com>
parents:
diff changeset
   161
			HTTP::EHEAD, RHTTPSession::GetTable()));
4927282092b4 Bug 208: inital CalDAV support for Symbian
Maximilian Odendahl <maximilian.odendahl@sun.com>
parents:
diff changeset
   162
	SetHeaderL(iTrans.Request().GetHeaderCollection(), HTTP::EUserAgent,
4927282092b4 Bug 208: inital CalDAV support for Symbian
Maximilian Odendahl <maximilian.odendahl@sun.com>
parents:
diff changeset
   163
			KUserAgent);
4927282092b4 Bug 208: inital CalDAV support for Symbian
Maximilian Odendahl <maximilian.odendahl@sun.com>
parents:
diff changeset
   164
	iTrans.SubmitL();
4927282092b4 Bug 208: inital CalDAV support for Symbian
Maximilian Odendahl <maximilian.odendahl@sun.com>
parents:
diff changeset
   165
	CActiveScheduler::Start();
4927282092b4 Bug 208: inital CalDAV support for Symbian
Maximilian Odendahl <maximilian.odendahl@sun.com>
parents:
diff changeset
   166
	return iReturnCode;
4927282092b4 Bug 208: inital CalDAV support for Symbian
Maximilian Odendahl <maximilian.odendahl@sun.com>
parents:
diff changeset
   167
	}
4927282092b4 Bug 208: inital CalDAV support for Symbian
Maximilian Odendahl <maximilian.odendahl@sun.com>
parents:
diff changeset
   168
4927282092b4 Bug 208: inital CalDAV support for Symbian
Maximilian Odendahl <maximilian.odendahl@sun.com>
parents:
diff changeset
   169
/**
4927282092b4 Bug 208: inital CalDAV support for Symbian
Maximilian Odendahl <maximilian.odendahl@sun.com>
parents:
diff changeset
   170
 * CHttpClient::GetL
4927282092b4 Bug 208: inital CalDAV support for Symbian
Maximilian Odendahl <maximilian.odendahl@sun.com>
parents:
diff changeset
   171
 * HTTP Get
4927282092b4 Bug 208: inital CalDAV support for Symbian
Maximilian Odendahl <maximilian.odendahl@sun.com>
parents:
diff changeset
   172
 */
4927282092b4 Bug 208: inital CalDAV support for Symbian
Maximilian Odendahl <maximilian.odendahl@sun.com>
parents:
diff changeset
   173
TInt CHttpClient::GetL(const TDesC8 &aUrl, CBufFlat *aResponse)
4927282092b4 Bug 208: inital CalDAV support for Symbian
Maximilian Odendahl <maximilian.odendahl@sun.com>
parents:
diff changeset
   174
	{
4927282092b4 Bug 208: inital CalDAV support for Symbian
Maximilian Odendahl <maximilian.odendahl@sun.com>
parents:
diff changeset
   175
	iReturnCode = ERROR;
4927282092b4 Bug 208: inital CalDAV support for Symbian
Maximilian Odendahl <maximilian.odendahl@sun.com>
parents:
diff changeset
   176
4927282092b4 Bug 208: inital CalDAV support for Symbian
Maximilian Odendahl <maximilian.odendahl@sun.com>
parents:
diff changeset
   177
	iBodyResponse = aResponse;
4927282092b4 Bug 208: inital CalDAV support for Symbian
Maximilian Odendahl <maximilian.odendahl@sun.com>
parents:
diff changeset
   178
4927282092b4 Bug 208: inital CalDAV support for Symbian
Maximilian Odendahl <maximilian.odendahl@sun.com>
parents:
diff changeset
   179
	TUriParser8 uri;
4927282092b4 Bug 208: inital CalDAV support for Symbian
Maximilian Odendahl <maximilian.odendahl@sun.com>
parents:
diff changeset
   180
	uri.Parse(aUrl);
4927282092b4 Bug 208: inital CalDAV support for Symbian
Maximilian Odendahl <maximilian.odendahl@sun.com>
parents:
diff changeset
   181
4927282092b4 Bug 208: inital CalDAV support for Symbian
Maximilian Odendahl <maximilian.odendahl@sun.com>
parents:
diff changeset
   182
	iTrans = iSess.OpenTransactionL(uri, *this, iSess.StringPool().StringF(
4927282092b4 Bug 208: inital CalDAV support for Symbian
Maximilian Odendahl <maximilian.odendahl@sun.com>
parents:
diff changeset
   183
			HTTP::EGET, RHTTPSession::GetTable()));
4927282092b4 Bug 208: inital CalDAV support for Symbian
Maximilian Odendahl <maximilian.odendahl@sun.com>
parents:
diff changeset
   184
	SetHeaderL(iTrans.Request().GetHeaderCollection(), HTTP::EUserAgent,
4927282092b4 Bug 208: inital CalDAV support for Symbian
Maximilian Odendahl <maximilian.odendahl@sun.com>
parents:
diff changeset
   185
			KUserAgent);
4927282092b4 Bug 208: inital CalDAV support for Symbian
Maximilian Odendahl <maximilian.odendahl@sun.com>
parents:
diff changeset
   186
	iTrans.SubmitL();
4927282092b4 Bug 208: inital CalDAV support for Symbian
Maximilian Odendahl <maximilian.odendahl@sun.com>
parents:
diff changeset
   187
	CActiveScheduler::Start();
4927282092b4 Bug 208: inital CalDAV support for Symbian
Maximilian Odendahl <maximilian.odendahl@sun.com>
parents:
diff changeset
   188
	iBodyResponse = NULL;
4927282092b4 Bug 208: inital CalDAV support for Symbian
Maximilian Odendahl <maximilian.odendahl@sun.com>
parents:
diff changeset
   189
	return iReturnCode;
4927282092b4 Bug 208: inital CalDAV support for Symbian
Maximilian Odendahl <maximilian.odendahl@sun.com>
parents:
diff changeset
   190
	}
4927282092b4 Bug 208: inital CalDAV support for Symbian
Maximilian Odendahl <maximilian.odendahl@sun.com>
parents:
diff changeset
   191
4927282092b4 Bug 208: inital CalDAV support for Symbian
Maximilian Odendahl <maximilian.odendahl@sun.com>
parents:
diff changeset
   192
/**
4927282092b4 Bug 208: inital CalDAV support for Symbian
Maximilian Odendahl <maximilian.odendahl@sun.com>
parents:
diff changeset
   193
 * CHttpClient::MkCalendarL
4927282092b4 Bug 208: inital CalDAV support for Symbian
Maximilian Odendahl <maximilian.odendahl@sun.com>
parents:
diff changeset
   194
 * Caldav MKCALENDAR
4927282092b4 Bug 208: inital CalDAV support for Symbian
Maximilian Odendahl <maximilian.odendahl@sun.com>
parents:
diff changeset
   195
 */
4927282092b4 Bug 208: inital CalDAV support for Symbian
Maximilian Odendahl <maximilian.odendahl@sun.com>
parents:
diff changeset
   196
TInt CHttpClient::MkCalendarL(const TDesC8 &aUrl, const TDesC8 &aBody,
4927282092b4 Bug 208: inital CalDAV support for Symbian
Maximilian Odendahl <maximilian.odendahl@sun.com>
parents:
diff changeset
   197
		CBufFlat *aResponse)
4927282092b4 Bug 208: inital CalDAV support for Symbian
Maximilian Odendahl <maximilian.odendahl@sun.com>
parents:
diff changeset
   198
	{
4927282092b4 Bug 208: inital CalDAV support for Symbian
Maximilian Odendahl <maximilian.odendahl@sun.com>
parents:
diff changeset
   199
	iReturnCode = ERROR;
4927282092b4 Bug 208: inital CalDAV support for Symbian
Maximilian Odendahl <maximilian.odendahl@sun.com>
parents:
diff changeset
   200
4927282092b4 Bug 208: inital CalDAV support for Symbian
Maximilian Odendahl <maximilian.odendahl@sun.com>
parents:
diff changeset
   201
	if (aBody != KNullDesC8)
4927282092b4 Bug 208: inital CalDAV support for Symbian
Maximilian Odendahl <maximilian.odendahl@sun.com>
parents:
diff changeset
   202
		{
4927282092b4 Bug 208: inital CalDAV support for Symbian
Maximilian Odendahl <maximilian.odendahl@sun.com>
parents:
diff changeset
   203
		iBodyRequest = aBody.Alloc();
4927282092b4 Bug 208: inital CalDAV support for Symbian
Maximilian Odendahl <maximilian.odendahl@sun.com>
parents:
diff changeset
   204
		iTrans.Request().SetBody(*this);
4927282092b4 Bug 208: inital CalDAV support for Symbian
Maximilian Odendahl <maximilian.odendahl@sun.com>
parents:
diff changeset
   205
		}
4927282092b4 Bug 208: inital CalDAV support for Symbian
Maximilian Odendahl <maximilian.odendahl@sun.com>
parents:
diff changeset
   206
4927282092b4 Bug 208: inital CalDAV support for Symbian
Maximilian Odendahl <maximilian.odendahl@sun.com>
parents:
diff changeset
   207
	iBodyResponse = aResponse;
4927282092b4 Bug 208: inital CalDAV support for Symbian
Maximilian Odendahl <maximilian.odendahl@sun.com>
parents:
diff changeset
   208
4927282092b4 Bug 208: inital CalDAV support for Symbian
Maximilian Odendahl <maximilian.odendahl@sun.com>
parents:
diff changeset
   209
	TUriParser8 uri;
4927282092b4 Bug 208: inital CalDAV support for Symbian
Maximilian Odendahl <maximilian.odendahl@sun.com>
parents:
diff changeset
   210
	uri.Parse(aUrl);
4927282092b4 Bug 208: inital CalDAV support for Symbian
Maximilian Odendahl <maximilian.odendahl@sun.com>
parents:
diff changeset
   211
4927282092b4 Bug 208: inital CalDAV support for Symbian
Maximilian Odendahl <maximilian.odendahl@sun.com>
parents:
diff changeset
   212
	RStringF mkcalendar = iSess.StringPool().OpenFStringL(MKCALENDAR);
4927282092b4 Bug 208: inital CalDAV support for Symbian
Maximilian Odendahl <maximilian.odendahl@sun.com>
parents:
diff changeset
   213
	iTrans = iSess.OpenTransactionL(uri, *this, mkcalendar);
4927282092b4 Bug 208: inital CalDAV support for Symbian
Maximilian Odendahl <maximilian.odendahl@sun.com>
parents:
diff changeset
   214
	RHTTPHeaders hdr = iTrans.Request().GetHeaderCollection();
4927282092b4 Bug 208: inital CalDAV support for Symbian
Maximilian Odendahl <maximilian.odendahl@sun.com>
parents:
diff changeset
   215
4927282092b4 Bug 208: inital CalDAV support for Symbian
Maximilian Odendahl <maximilian.odendahl@sun.com>
parents:
diff changeset
   216
	SetHeaderL(hdr, HTTP::EUserAgent, KUserAgent);
4927282092b4 Bug 208: inital CalDAV support for Symbian
Maximilian Odendahl <maximilian.odendahl@sun.com>
parents:
diff changeset
   217
	SetHeaderL(hdr, HTTP::EContentType, KTextXml);
4927282092b4 Bug 208: inital CalDAV support for Symbian
Maximilian Odendahl <maximilian.odendahl@sun.com>
parents:
diff changeset
   218
4927282092b4 Bug 208: inital CalDAV support for Symbian
Maximilian Odendahl <maximilian.odendahl@sun.com>
parents:
diff changeset
   219
	iTrans.SubmitL();
4927282092b4 Bug 208: inital CalDAV support for Symbian
Maximilian Odendahl <maximilian.odendahl@sun.com>
parents:
diff changeset
   220
	CActiveScheduler::Start();
4927282092b4 Bug 208: inital CalDAV support for Symbian
Maximilian Odendahl <maximilian.odendahl@sun.com>
parents:
diff changeset
   221
4927282092b4 Bug 208: inital CalDAV support for Symbian
Maximilian Odendahl <maximilian.odendahl@sun.com>
parents:
diff changeset
   222
	mkcalendar.Close();
4927282092b4 Bug 208: inital CalDAV support for Symbian
Maximilian Odendahl <maximilian.odendahl@sun.com>
parents:
diff changeset
   223
	if (iBodyRequest)
4927282092b4 Bug 208: inital CalDAV support for Symbian
Maximilian Odendahl <maximilian.odendahl@sun.com>
parents:
diff changeset
   224
		{
4927282092b4 Bug 208: inital CalDAV support for Symbian
Maximilian Odendahl <maximilian.odendahl@sun.com>
parents:
diff changeset
   225
		delete iBodyRequest;
4927282092b4 Bug 208: inital CalDAV support for Symbian
Maximilian Odendahl <maximilian.odendahl@sun.com>
parents:
diff changeset
   226
		iBodyRequest = NULL;
4927282092b4 Bug 208: inital CalDAV support for Symbian
Maximilian Odendahl <maximilian.odendahl@sun.com>
parents:
diff changeset
   227
		}
4927282092b4 Bug 208: inital CalDAV support for Symbian
Maximilian Odendahl <maximilian.odendahl@sun.com>
parents:
diff changeset
   228
	iBodyResponse = NULL;
4927282092b4 Bug 208: inital CalDAV support for Symbian
Maximilian Odendahl <maximilian.odendahl@sun.com>
parents:
diff changeset
   229
4927282092b4 Bug 208: inital CalDAV support for Symbian
Maximilian Odendahl <maximilian.odendahl@sun.com>
parents:
diff changeset
   230
	return iReturnCode;
4927282092b4 Bug 208: inital CalDAV support for Symbian
Maximilian Odendahl <maximilian.odendahl@sun.com>
parents:
diff changeset
   231
	}
4927282092b4 Bug 208: inital CalDAV support for Symbian
Maximilian Odendahl <maximilian.odendahl@sun.com>
parents:
diff changeset
   232
4927282092b4 Bug 208: inital CalDAV support for Symbian
Maximilian Odendahl <maximilian.odendahl@sun.com>
parents:
diff changeset
   233
/**
4927282092b4 Bug 208: inital CalDAV support for Symbian
Maximilian Odendahl <maximilian.odendahl@sun.com>
parents:
diff changeset
   234
 * CHttpClient::PutL
4927282092b4 Bug 208: inital CalDAV support for Symbian
Maximilian Odendahl <maximilian.odendahl@sun.com>
parents:
diff changeset
   235
 * HTTP PUT
4927282092b4 Bug 208: inital CalDAV support for Symbian
Maximilian Odendahl <maximilian.odendahl@sun.com>
parents:
diff changeset
   236
 */
4927282092b4 Bug 208: inital CalDAV support for Symbian
Maximilian Odendahl <maximilian.odendahl@sun.com>
parents:
diff changeset
   237
TInt CHttpClient::PutL(const TDesC8 &aUrl, const TDesC8 &aIcs,
4927282092b4 Bug 208: inital CalDAV support for Symbian
Maximilian Odendahl <maximilian.odendahl@sun.com>
parents:
diff changeset
   238
		CBufFlat *aResponse, const TDesC8 &aEtag)
4927282092b4 Bug 208: inital CalDAV support for Symbian
Maximilian Odendahl <maximilian.odendahl@sun.com>
parents:
diff changeset
   239
	{
4927282092b4 Bug 208: inital CalDAV support for Symbian
Maximilian Odendahl <maximilian.odendahl@sun.com>
parents:
diff changeset
   240
	iReturnCode = ERROR;
4927282092b4 Bug 208: inital CalDAV support for Symbian
Maximilian Odendahl <maximilian.odendahl@sun.com>
parents:
diff changeset
   241
4927282092b4 Bug 208: inital CalDAV support for Symbian
Maximilian Odendahl <maximilian.odendahl@sun.com>
parents:
diff changeset
   242
	iBodyRequest = aIcs.Alloc();
4927282092b4 Bug 208: inital CalDAV support for Symbian
Maximilian Odendahl <maximilian.odendahl@sun.com>
parents:
diff changeset
   243
	iBodyResponse = aResponse;
4927282092b4 Bug 208: inital CalDAV support for Symbian
Maximilian Odendahl <maximilian.odendahl@sun.com>
parents:
diff changeset
   244
4927282092b4 Bug 208: inital CalDAV support for Symbian
Maximilian Odendahl <maximilian.odendahl@sun.com>
parents:
diff changeset
   245
	TUriParser8 uri;
4927282092b4 Bug 208: inital CalDAV support for Symbian
Maximilian Odendahl <maximilian.odendahl@sun.com>
parents:
diff changeset
   246
	uri.Parse(aUrl);
4927282092b4 Bug 208: inital CalDAV support for Symbian
Maximilian Odendahl <maximilian.odendahl@sun.com>
parents:
diff changeset
   247
4927282092b4 Bug 208: inital CalDAV support for Symbian
Maximilian Odendahl <maximilian.odendahl@sun.com>
parents:
diff changeset
   248
	iTrans = iSess.OpenTransactionL(uri, *this, iSess.StringPool().StringF(
4927282092b4 Bug 208: inital CalDAV support for Symbian
Maximilian Odendahl <maximilian.odendahl@sun.com>
parents:
diff changeset
   249
			HTTP::EPUT, RHTTPSession::GetTable()));
4927282092b4 Bug 208: inital CalDAV support for Symbian
Maximilian Odendahl <maximilian.odendahl@sun.com>
parents:
diff changeset
   250
	RHTTPHeaders hdr = iTrans.Request().GetHeaderCollection();
4927282092b4 Bug 208: inital CalDAV support for Symbian
Maximilian Odendahl <maximilian.odendahl@sun.com>
parents:
diff changeset
   251
4927282092b4 Bug 208: inital CalDAV support for Symbian
Maximilian Odendahl <maximilian.odendahl@sun.com>
parents:
diff changeset
   252
	iTrans.Request().SetBody(*this);
4927282092b4 Bug 208: inital CalDAV support for Symbian
Maximilian Odendahl <maximilian.odendahl@sun.com>
parents:
diff changeset
   253
4927282092b4 Bug 208: inital CalDAV support for Symbian
Maximilian Odendahl <maximilian.odendahl@sun.com>
parents:
diff changeset
   254
	if (aEtag == KNullDesC8)
4927282092b4 Bug 208: inital CalDAV support for Symbian
Maximilian Odendahl <maximilian.odendahl@sun.com>
parents:
diff changeset
   255
		{
4927282092b4 Bug 208: inital CalDAV support for Symbian
Maximilian Odendahl <maximilian.odendahl@sun.com>
parents:
diff changeset
   256
		_LIT8(KStar, "*");
4927282092b4 Bug 208: inital CalDAV support for Symbian
Maximilian Odendahl <maximilian.odendahl@sun.com>
parents:
diff changeset
   257
		SetHeaderL(hdr, HTTP::EIfNoneMatch, KStar);
4927282092b4 Bug 208: inital CalDAV support for Symbian
Maximilian Odendahl <maximilian.odendahl@sun.com>
parents:
diff changeset
   258
		}
4927282092b4 Bug 208: inital CalDAV support for Symbian
Maximilian Odendahl <maximilian.odendahl@sun.com>
parents:
diff changeset
   259
	else
4927282092b4 Bug 208: inital CalDAV support for Symbian
Maximilian Odendahl <maximilian.odendahl@sun.com>
parents:
diff changeset
   260
		{
4927282092b4 Bug 208: inital CalDAV support for Symbian
Maximilian Odendahl <maximilian.odendahl@sun.com>
parents:
diff changeset
   261
#ifdef ETAG
4927282092b4 Bug 208: inital CalDAV support for Symbian
Maximilian Odendahl <maximilian.odendahl@sun.com>
parents:
diff changeset
   262
		 SetHeaderL(hdr,HTTP::EIfMatch,aEtag);
4927282092b4 Bug 208: inital CalDAV support for Symbian
Maximilian Odendahl <maximilian.odendahl@sun.com>
parents:
diff changeset
   263
#endif
4927282092b4 Bug 208: inital CalDAV support for Symbian
Maximilian Odendahl <maximilian.odendahl@sun.com>
parents:
diff changeset
   264
		}
4927282092b4 Bug 208: inital CalDAV support for Symbian
Maximilian Odendahl <maximilian.odendahl@sun.com>
parents:
diff changeset
   265
4927282092b4 Bug 208: inital CalDAV support for Symbian
Maximilian Odendahl <maximilian.odendahl@sun.com>
parents:
diff changeset
   266
	SetHeaderL(hdr, HTTP::EUserAgent, KUserAgent);
4927282092b4 Bug 208: inital CalDAV support for Symbian
Maximilian Odendahl <maximilian.odendahl@sun.com>
parents:
diff changeset
   267
	SetHeaderL(hdr, HTTP::EContentType, KTextCalendar);
4927282092b4 Bug 208: inital CalDAV support for Symbian
Maximilian Odendahl <maximilian.odendahl@sun.com>
parents:
diff changeset
   268
4927282092b4 Bug 208: inital CalDAV support for Symbian
Maximilian Odendahl <maximilian.odendahl@sun.com>
parents:
diff changeset
   269
	iTrans.SubmitL();
4927282092b4 Bug 208: inital CalDAV support for Symbian
Maximilian Odendahl <maximilian.odendahl@sun.com>
parents:
diff changeset
   270
	CActiveScheduler::Start();
4927282092b4 Bug 208: inital CalDAV support for Symbian
Maximilian Odendahl <maximilian.odendahl@sun.com>
parents:
diff changeset
   271
4927282092b4 Bug 208: inital CalDAV support for Symbian
Maximilian Odendahl <maximilian.odendahl@sun.com>
parents:
diff changeset
   272
	delete iBodyRequest;
4927282092b4 Bug 208: inital CalDAV support for Symbian
Maximilian Odendahl <maximilian.odendahl@sun.com>
parents:
diff changeset
   273
	iBodyRequest = NULL;
4927282092b4 Bug 208: inital CalDAV support for Symbian
Maximilian Odendahl <maximilian.odendahl@sun.com>
parents:
diff changeset
   274
	iBodyResponse = NULL;
4927282092b4 Bug 208: inital CalDAV support for Symbian
Maximilian Odendahl <maximilian.odendahl@sun.com>
parents:
diff changeset
   275
4927282092b4 Bug 208: inital CalDAV support for Symbian
Maximilian Odendahl <maximilian.odendahl@sun.com>
parents:
diff changeset
   276
	return iReturnCode;
4927282092b4 Bug 208: inital CalDAV support for Symbian
Maximilian Odendahl <maximilian.odendahl@sun.com>
parents:
diff changeset
   277
	}
4927282092b4 Bug 208: inital CalDAV support for Symbian
Maximilian Odendahl <maximilian.odendahl@sun.com>
parents:
diff changeset
   278
4927282092b4 Bug 208: inital CalDAV support for Symbian
Maximilian Odendahl <maximilian.odendahl@sun.com>
parents:
diff changeset
   279
/**
4927282092b4 Bug 208: inital CalDAV support for Symbian
Maximilian Odendahl <maximilian.odendahl@sun.com>
parents:
diff changeset
   280
 * CHttpClient::ReportL
4927282092b4 Bug 208: inital CalDAV support for Symbian
Maximilian Odendahl <maximilian.odendahl@sun.com>
parents:
diff changeset
   281
 * Caldav REPORT 
4927282092b4 Bug 208: inital CalDAV support for Symbian
Maximilian Odendahl <maximilian.odendahl@sun.com>
parents:
diff changeset
   282
 */
4927282092b4 Bug 208: inital CalDAV support for Symbian
Maximilian Odendahl <maximilian.odendahl@sun.com>
parents:
diff changeset
   283
TInt CHttpClient::ReportL(const TDesC8 &aUrl, const TDesC8 &aBodyRequest,
4927282092b4 Bug 208: inital CalDAV support for Symbian
Maximilian Odendahl <maximilian.odendahl@sun.com>
parents:
diff changeset
   284
		CBufFlat *aResponse)
4927282092b4 Bug 208: inital CalDAV support for Symbian
Maximilian Odendahl <maximilian.odendahl@sun.com>
parents:
diff changeset
   285
	{
4927282092b4 Bug 208: inital CalDAV support for Symbian
Maximilian Odendahl <maximilian.odendahl@sun.com>
parents:
diff changeset
   286
	iReturnCode = ERROR;
4927282092b4 Bug 208: inital CalDAV support for Symbian
Maximilian Odendahl <maximilian.odendahl@sun.com>
parents:
diff changeset
   287
	iBodyResponse = aResponse;
4927282092b4 Bug 208: inital CalDAV support for Symbian
Maximilian Odendahl <maximilian.odendahl@sun.com>
parents:
diff changeset
   288
4927282092b4 Bug 208: inital CalDAV support for Symbian
Maximilian Odendahl <maximilian.odendahl@sun.com>
parents:
diff changeset
   289
	TUriParser8 uri;
4927282092b4 Bug 208: inital CalDAV support for Symbian
Maximilian Odendahl <maximilian.odendahl@sun.com>
parents:
diff changeset
   290
	uri.Parse(aUrl);
4927282092b4 Bug 208: inital CalDAV support for Symbian
Maximilian Odendahl <maximilian.odendahl@sun.com>
parents:
diff changeset
   291
4927282092b4 Bug 208: inital CalDAV support for Symbian
Maximilian Odendahl <maximilian.odendahl@sun.com>
parents:
diff changeset
   292
	RStringF report = iSess.StringPool().OpenFStringL(REPORT);
4927282092b4 Bug 208: inital CalDAV support for Symbian
Maximilian Odendahl <maximilian.odendahl@sun.com>
parents:
diff changeset
   293
	iTrans = iSess.OpenTransactionL(uri, *this, report);
4927282092b4 Bug 208: inital CalDAV support for Symbian
Maximilian Odendahl <maximilian.odendahl@sun.com>
parents:
diff changeset
   294
	if (aBodyRequest.Length())
4927282092b4 Bug 208: inital CalDAV support for Symbian
Maximilian Odendahl <maximilian.odendahl@sun.com>
parents:
diff changeset
   295
		{
4927282092b4 Bug 208: inital CalDAV support for Symbian
Maximilian Odendahl <maximilian.odendahl@sun.com>
parents:
diff changeset
   296
		iBodyRequest = aBodyRequest.Alloc();
4927282092b4 Bug 208: inital CalDAV support for Symbian
Maximilian Odendahl <maximilian.odendahl@sun.com>
parents:
diff changeset
   297
		iTrans.Request().SetBody(*this);
4927282092b4 Bug 208: inital CalDAV support for Symbian
Maximilian Odendahl <maximilian.odendahl@sun.com>
parents:
diff changeset
   298
		}
4927282092b4 Bug 208: inital CalDAV support for Symbian
Maximilian Odendahl <maximilian.odendahl@sun.com>
parents:
diff changeset
   299
4927282092b4 Bug 208: inital CalDAV support for Symbian
Maximilian Odendahl <maximilian.odendahl@sun.com>
parents:
diff changeset
   300
	RHTTPHeaders hdr = iTrans.Request().GetHeaderCollection();
4927282092b4 Bug 208: inital CalDAV support for Symbian
Maximilian Odendahl <maximilian.odendahl@sun.com>
parents:
diff changeset
   301
	SetHeaderL(hdr, HTTP::EContentType, KTextXml);
4927282092b4 Bug 208: inital CalDAV support for Symbian
Maximilian Odendahl <maximilian.odendahl@sun.com>
parents:
diff changeset
   302
	SetHeaderL(hdr, KDepth, ONE);
4927282092b4 Bug 208: inital CalDAV support for Symbian
Maximilian Odendahl <maximilian.odendahl@sun.com>
parents:
diff changeset
   303
	SetHeaderL(hdr, HTTP::EUserAgent, KUserAgent);
4927282092b4 Bug 208: inital CalDAV support for Symbian
Maximilian Odendahl <maximilian.odendahl@sun.com>
parents:
diff changeset
   304
	iTrans.SubmitL();
4927282092b4 Bug 208: inital CalDAV support for Symbian
Maximilian Odendahl <maximilian.odendahl@sun.com>
parents:
diff changeset
   305
	CActiveScheduler::Start();
4927282092b4 Bug 208: inital CalDAV support for Symbian
Maximilian Odendahl <maximilian.odendahl@sun.com>
parents:
diff changeset
   306
4927282092b4 Bug 208: inital CalDAV support for Symbian
Maximilian Odendahl <maximilian.odendahl@sun.com>
parents:
diff changeset
   307
	report.Close();
4927282092b4 Bug 208: inital CalDAV support for Symbian
Maximilian Odendahl <maximilian.odendahl@sun.com>
parents:
diff changeset
   308
4927282092b4 Bug 208: inital CalDAV support for Symbian
Maximilian Odendahl <maximilian.odendahl@sun.com>
parents:
diff changeset
   309
	delete iBodyRequest;
4927282092b4 Bug 208: inital CalDAV support for Symbian
Maximilian Odendahl <maximilian.odendahl@sun.com>
parents:
diff changeset
   310
	iBodyRequest = NULL;
4927282092b4 Bug 208: inital CalDAV support for Symbian
Maximilian Odendahl <maximilian.odendahl@sun.com>
parents:
diff changeset
   311
	iBodyResponse = NULL;
4927282092b4 Bug 208: inital CalDAV support for Symbian
Maximilian Odendahl <maximilian.odendahl@sun.com>
parents:
diff changeset
   312
4927282092b4 Bug 208: inital CalDAV support for Symbian
Maximilian Odendahl <maximilian.odendahl@sun.com>
parents:
diff changeset
   313
	return iReturnCode;
4927282092b4 Bug 208: inital CalDAV support for Symbian
Maximilian Odendahl <maximilian.odendahl@sun.com>
parents:
diff changeset
   314
	}
4927282092b4 Bug 208: inital CalDAV support for Symbian
Maximilian Odendahl <maximilian.odendahl@sun.com>
parents:
diff changeset
   315
4927282092b4 Bug 208: inital CalDAV support for Symbian
Maximilian Odendahl <maximilian.odendahl@sun.com>
parents:
diff changeset
   316
/**
4927282092b4 Bug 208: inital CalDAV support for Symbian
Maximilian Odendahl <maximilian.odendahl@sun.com>
parents:
diff changeset
   317
 * CHttpClient::PropfindL
4927282092b4 Bug 208: inital CalDAV support for Symbian
Maximilian Odendahl <maximilian.odendahl@sun.com>
parents:
diff changeset
   318
 * WebDAV PROPFIND
4927282092b4 Bug 208: inital CalDAV support for Symbian
Maximilian Odendahl <maximilian.odendahl@sun.com>
parents:
diff changeset
   319
 */
4927282092b4 Bug 208: inital CalDAV support for Symbian
Maximilian Odendahl <maximilian.odendahl@sun.com>
parents:
diff changeset
   320
TInt CHttpClient::PropfindL(const TDesC8 &aUrl, const TDesC8 &aBodyRequest,
4927282092b4 Bug 208: inital CalDAV support for Symbian
Maximilian Odendahl <maximilian.odendahl@sun.com>
parents:
diff changeset
   321
		CBufFlat *aResponse, TBool depth)
4927282092b4 Bug 208: inital CalDAV support for Symbian
Maximilian Odendahl <maximilian.odendahl@sun.com>
parents:
diff changeset
   322
	{
4927282092b4 Bug 208: inital CalDAV support for Symbian
Maximilian Odendahl <maximilian.odendahl@sun.com>
parents:
diff changeset
   323
	iReturnCode = ERROR;
4927282092b4 Bug 208: inital CalDAV support for Symbian
Maximilian Odendahl <maximilian.odendahl@sun.com>
parents:
diff changeset
   324
	iBodyResponse = aResponse;
4927282092b4 Bug 208: inital CalDAV support for Symbian
Maximilian Odendahl <maximilian.odendahl@sun.com>
parents:
diff changeset
   325
4927282092b4 Bug 208: inital CalDAV support for Symbian
Maximilian Odendahl <maximilian.odendahl@sun.com>
parents:
diff changeset
   326
	TUriParser8 uri;
4927282092b4 Bug 208: inital CalDAV support for Symbian
Maximilian Odendahl <maximilian.odendahl@sun.com>
parents:
diff changeset
   327
	uri.Parse(aUrl);
4927282092b4 Bug 208: inital CalDAV support for Symbian
Maximilian Odendahl <maximilian.odendahl@sun.com>
parents:
diff changeset
   328
4927282092b4 Bug 208: inital CalDAV support for Symbian
Maximilian Odendahl <maximilian.odendahl@sun.com>
parents:
diff changeset
   329
	RStringF propfind = iSess.StringPool().OpenFStringL(PROPFIND);
4927282092b4 Bug 208: inital CalDAV support for Symbian
Maximilian Odendahl <maximilian.odendahl@sun.com>
parents:
diff changeset
   330
	iTrans = iSess.OpenTransactionL(uri, *this, propfind);
4927282092b4 Bug 208: inital CalDAV support for Symbian
Maximilian Odendahl <maximilian.odendahl@sun.com>
parents:
diff changeset
   331
	if (aBodyRequest.Length())
4927282092b4 Bug 208: inital CalDAV support for Symbian
Maximilian Odendahl <maximilian.odendahl@sun.com>
parents:
diff changeset
   332
		{
4927282092b4 Bug 208: inital CalDAV support for Symbian
Maximilian Odendahl <maximilian.odendahl@sun.com>
parents:
diff changeset
   333
		iBodyRequest = aBodyRequest.Alloc();
4927282092b4 Bug 208: inital CalDAV support for Symbian
Maximilian Odendahl <maximilian.odendahl@sun.com>
parents:
diff changeset
   334
		iTrans.Request().SetBody(*this);
4927282092b4 Bug 208: inital CalDAV support for Symbian
Maximilian Odendahl <maximilian.odendahl@sun.com>
parents:
diff changeset
   335
		}
4927282092b4 Bug 208: inital CalDAV support for Symbian
Maximilian Odendahl <maximilian.odendahl@sun.com>
parents:
diff changeset
   336
4927282092b4 Bug 208: inital CalDAV support for Symbian
Maximilian Odendahl <maximilian.odendahl@sun.com>
parents:
diff changeset
   337
	RHTTPHeaders hdr = iTrans.Request().GetHeaderCollection();
4927282092b4 Bug 208: inital CalDAV support for Symbian
Maximilian Odendahl <maximilian.odendahl@sun.com>
parents:
diff changeset
   338
	SetHeaderL(hdr, HTTP::EContentType, KTextXml);
4927282092b4 Bug 208: inital CalDAV support for Symbian
Maximilian Odendahl <maximilian.odendahl@sun.com>
parents:
diff changeset
   339
	SetHeaderL(hdr, HTTP::EUserAgent, KUserAgent);
4927282092b4 Bug 208: inital CalDAV support for Symbian
Maximilian Odendahl <maximilian.odendahl@sun.com>
parents:
diff changeset
   340
	if (depth)
4927282092b4 Bug 208: inital CalDAV support for Symbian
Maximilian Odendahl <maximilian.odendahl@sun.com>
parents:
diff changeset
   341
		SetHeaderL(hdr, KDepth, ZERO);
4927282092b4 Bug 208: inital CalDAV support for Symbian
Maximilian Odendahl <maximilian.odendahl@sun.com>
parents:
diff changeset
   342
	else
4927282092b4 Bug 208: inital CalDAV support for Symbian
Maximilian Odendahl <maximilian.odendahl@sun.com>
parents:
diff changeset
   343
		SetHeaderL(hdr, KDepth, ONE);
4927282092b4 Bug 208: inital CalDAV support for Symbian
Maximilian Odendahl <maximilian.odendahl@sun.com>
parents:
diff changeset
   344
4927282092b4 Bug 208: inital CalDAV support for Symbian
Maximilian Odendahl <maximilian.odendahl@sun.com>
parents:
diff changeset
   345
	iTrans.SubmitL();
4927282092b4 Bug 208: inital CalDAV support for Symbian
Maximilian Odendahl <maximilian.odendahl@sun.com>
parents:
diff changeset
   346
	CActiveScheduler::Start();
4927282092b4 Bug 208: inital CalDAV support for Symbian
Maximilian Odendahl <maximilian.odendahl@sun.com>
parents:
diff changeset
   347
4927282092b4 Bug 208: inital CalDAV support for Symbian
Maximilian Odendahl <maximilian.odendahl@sun.com>
parents:
diff changeset
   348
	propfind.Close();
4927282092b4 Bug 208: inital CalDAV support for Symbian
Maximilian Odendahl <maximilian.odendahl@sun.com>
parents:
diff changeset
   349
4927282092b4 Bug 208: inital CalDAV support for Symbian
Maximilian Odendahl <maximilian.odendahl@sun.com>
parents:
diff changeset
   350
	delete iBodyRequest;
4927282092b4 Bug 208: inital CalDAV support for Symbian
Maximilian Odendahl <maximilian.odendahl@sun.com>
parents:
diff changeset
   351
	iBodyRequest = NULL;
4927282092b4 Bug 208: inital CalDAV support for Symbian
Maximilian Odendahl <maximilian.odendahl@sun.com>
parents:
diff changeset
   352
	iBodyResponse = NULL;
4927282092b4 Bug 208: inital CalDAV support for Symbian
Maximilian Odendahl <maximilian.odendahl@sun.com>
parents:
diff changeset
   353
4927282092b4 Bug 208: inital CalDAV support for Symbian
Maximilian Odendahl <maximilian.odendahl@sun.com>
parents:
diff changeset
   354
	return iReturnCode;
4927282092b4 Bug 208: inital CalDAV support for Symbian
Maximilian Odendahl <maximilian.odendahl@sun.com>
parents:
diff changeset
   355
	}
4927282092b4 Bug 208: inital CalDAV support for Symbian
Maximilian Odendahl <maximilian.odendahl@sun.com>
parents:
diff changeset
   356
4927282092b4 Bug 208: inital CalDAV support for Symbian
Maximilian Odendahl <maximilian.odendahl@sun.com>
parents:
diff changeset
   357
/**
4927282092b4 Bug 208: inital CalDAV support for Symbian
Maximilian Odendahl <maximilian.odendahl@sun.com>
parents:
diff changeset
   358
 * CHttpClient::ProppatchL
4927282092b4 Bug 208: inital CalDAV support for Symbian
Maximilian Odendahl <maximilian.odendahl@sun.com>
parents:
diff changeset
   359
 * Webdav PROPPATCH
4927282092b4 Bug 208: inital CalDAV support for Symbian
Maximilian Odendahl <maximilian.odendahl@sun.com>
parents:
diff changeset
   360
 */
4927282092b4 Bug 208: inital CalDAV support for Symbian
Maximilian Odendahl <maximilian.odendahl@sun.com>
parents:
diff changeset
   361
TInt CHttpClient::ProppatchL(const TDesC8 &aUrl, const TDesC8 &aBodyRequest, CBufFlat *aResponse)
4927282092b4 Bug 208: inital CalDAV support for Symbian
Maximilian Odendahl <maximilian.odendahl@sun.com>
parents:
diff changeset
   362
	{
4927282092b4 Bug 208: inital CalDAV support for Symbian
Maximilian Odendahl <maximilian.odendahl@sun.com>
parents:
diff changeset
   363
	iReturnCode = ERROR;
4927282092b4 Bug 208: inital CalDAV support for Symbian
Maximilian Odendahl <maximilian.odendahl@sun.com>
parents:
diff changeset
   364
	iBodyResponse = aResponse;
4927282092b4 Bug 208: inital CalDAV support for Symbian
Maximilian Odendahl <maximilian.odendahl@sun.com>
parents:
diff changeset
   365
4927282092b4 Bug 208: inital CalDAV support for Symbian
Maximilian Odendahl <maximilian.odendahl@sun.com>
parents:
diff changeset
   366
	TUriParser8 uri;
4927282092b4 Bug 208: inital CalDAV support for Symbian
Maximilian Odendahl <maximilian.odendahl@sun.com>
parents:
diff changeset
   367
	uri.Parse(aUrl);
4927282092b4 Bug 208: inital CalDAV support for Symbian
Maximilian Odendahl <maximilian.odendahl@sun.com>
parents:
diff changeset
   368
4927282092b4 Bug 208: inital CalDAV support for Symbian
Maximilian Odendahl <maximilian.odendahl@sun.com>
parents:
diff changeset
   369
	RStringF proppatch = iSess.StringPool().OpenFStringL(PROPPATCH);
4927282092b4 Bug 208: inital CalDAV support for Symbian
Maximilian Odendahl <maximilian.odendahl@sun.com>
parents:
diff changeset
   370
	iTrans = iSess.OpenTransactionL(uri, *this, proppatch);
4927282092b4 Bug 208: inital CalDAV support for Symbian
Maximilian Odendahl <maximilian.odendahl@sun.com>
parents:
diff changeset
   371
	RHTTPHeaders hdr = iTrans.Request().GetHeaderCollection();
4927282092b4 Bug 208: inital CalDAV support for Symbian
Maximilian Odendahl <maximilian.odendahl@sun.com>
parents:
diff changeset
   372
	SetHeaderL(hdr, HTTP::EUserAgent, KUserAgent);
4927282092b4 Bug 208: inital CalDAV support for Symbian
Maximilian Odendahl <maximilian.odendahl@sun.com>
parents:
diff changeset
   373
	SetHeaderL(hdr, HTTP::EContentType, KTextXml);
4927282092b4 Bug 208: inital CalDAV support for Symbian
Maximilian Odendahl <maximilian.odendahl@sun.com>
parents:
diff changeset
   374
	
4927282092b4 Bug 208: inital CalDAV support for Symbian
Maximilian Odendahl <maximilian.odendahl@sun.com>
parents:
diff changeset
   375
	iBodyRequest = aBodyRequest.Alloc();
4927282092b4 Bug 208: inital CalDAV support for Symbian
Maximilian Odendahl <maximilian.odendahl@sun.com>
parents:
diff changeset
   376
	iTrans.Request().SetBody(*this);
4927282092b4 Bug 208: inital CalDAV support for Symbian
Maximilian Odendahl <maximilian.odendahl@sun.com>
parents:
diff changeset
   377
	
4927282092b4 Bug 208: inital CalDAV support for Symbian
Maximilian Odendahl <maximilian.odendahl@sun.com>
parents:
diff changeset
   378
	iTrans.SubmitL();
4927282092b4 Bug 208: inital CalDAV support for Symbian
Maximilian Odendahl <maximilian.odendahl@sun.com>
parents:
diff changeset
   379
	CActiveScheduler::Start();
4927282092b4 Bug 208: inital CalDAV support for Symbian
Maximilian Odendahl <maximilian.odendahl@sun.com>
parents:
diff changeset
   380
4927282092b4 Bug 208: inital CalDAV support for Symbian
Maximilian Odendahl <maximilian.odendahl@sun.com>
parents:
diff changeset
   381
	proppatch.Close();
4927282092b4 Bug 208: inital CalDAV support for Symbian
Maximilian Odendahl <maximilian.odendahl@sun.com>
parents:
diff changeset
   382
4927282092b4 Bug 208: inital CalDAV support for Symbian
Maximilian Odendahl <maximilian.odendahl@sun.com>
parents:
diff changeset
   383
	delete iBodyRequest;
4927282092b4 Bug 208: inital CalDAV support for Symbian
Maximilian Odendahl <maximilian.odendahl@sun.com>
parents:
diff changeset
   384
	iBodyRequest = NULL;
4927282092b4 Bug 208: inital CalDAV support for Symbian
Maximilian Odendahl <maximilian.odendahl@sun.com>
parents:
diff changeset
   385
	iBodyResponse = NULL;
4927282092b4 Bug 208: inital CalDAV support for Symbian
Maximilian Odendahl <maximilian.odendahl@sun.com>
parents:
diff changeset
   386
4927282092b4 Bug 208: inital CalDAV support for Symbian
Maximilian Odendahl <maximilian.odendahl@sun.com>
parents:
diff changeset
   387
	return iReturnCode;
4927282092b4 Bug 208: inital CalDAV support for Symbian
Maximilian Odendahl <maximilian.odendahl@sun.com>
parents:
diff changeset
   388
	}
4927282092b4 Bug 208: inital CalDAV support for Symbian
Maximilian Odendahl <maximilian.odendahl@sun.com>
parents:
diff changeset
   389
4927282092b4 Bug 208: inital CalDAV support for Symbian
Maximilian Odendahl <maximilian.odendahl@sun.com>
parents:
diff changeset
   390
/**
4927282092b4 Bug 208: inital CalDAV support for Symbian
Maximilian Odendahl <maximilian.odendahl@sun.com>
parents:
diff changeset
   391
 * CHttpClient::GetServerOptionsL
4927282092b4 Bug 208: inital CalDAV support for Symbian
Maximilian Odendahl <maximilian.odendahl@sun.com>
parents:
diff changeset
   392
 * HTTP OPTIONS
4927282092b4 Bug 208: inital CalDAV support for Symbian
Maximilian Odendahl <maximilian.odendahl@sun.com>
parents:
diff changeset
   393
 */
4927282092b4 Bug 208: inital CalDAV support for Symbian
Maximilian Odendahl <maximilian.odendahl@sun.com>
parents:
diff changeset
   394
TInt CHttpClient::GetServerOptionsL(const TDesC8 &aUrl,
4927282092b4 Bug 208: inital CalDAV support for Symbian
Maximilian Odendahl <maximilian.odendahl@sun.com>
parents:
diff changeset
   395
		TCalDAVOptions &aOptions)
4927282092b4 Bug 208: inital CalDAV support for Symbian
Maximilian Odendahl <maximilian.odendahl@sun.com>
parents:
diff changeset
   396
	{
4927282092b4 Bug 208: inital CalDAV support for Symbian
Maximilian Odendahl <maximilian.odendahl@sun.com>
parents:
diff changeset
   397
	iReturnCode = ERROR;
4927282092b4 Bug 208: inital CalDAV support for Symbian
Maximilian Odendahl <maximilian.odendahl@sun.com>
parents:
diff changeset
   398
	iAction = EActionOption;
4927282092b4 Bug 208: inital CalDAV support for Symbian
Maximilian Odendahl <maximilian.odendahl@sun.com>
parents:
diff changeset
   399
	iOptions = &aOptions;
4927282092b4 Bug 208: inital CalDAV support for Symbian
Maximilian Odendahl <maximilian.odendahl@sun.com>
parents:
diff changeset
   400
4927282092b4 Bug 208: inital CalDAV support for Symbian
Maximilian Odendahl <maximilian.odendahl@sun.com>
parents:
diff changeset
   401
	TUriParser8 uri;
4927282092b4 Bug 208: inital CalDAV support for Symbian
Maximilian Odendahl <maximilian.odendahl@sun.com>
parents:
diff changeset
   402
	uri.Parse(aUrl);
4927282092b4 Bug 208: inital CalDAV support for Symbian
Maximilian Odendahl <maximilian.odendahl@sun.com>
parents:
diff changeset
   403
4927282092b4 Bug 208: inital CalDAV support for Symbian
Maximilian Odendahl <maximilian.odendahl@sun.com>
parents:
diff changeset
   404
	RStringF options = iSess.StringPool().OpenFStringL(OPTIONS);
4927282092b4 Bug 208: inital CalDAV support for Symbian
Maximilian Odendahl <maximilian.odendahl@sun.com>
parents:
diff changeset
   405
	iTrans = iSess.OpenTransactionL(uri, *this, options);
4927282092b4 Bug 208: inital CalDAV support for Symbian
Maximilian Odendahl <maximilian.odendahl@sun.com>
parents:
diff changeset
   406
	SetHeaderL(iTrans.Request().GetHeaderCollection(), HTTP::EUserAgent,
4927282092b4 Bug 208: inital CalDAV support for Symbian
Maximilian Odendahl <maximilian.odendahl@sun.com>
parents:
diff changeset
   407
			KUserAgent);
4927282092b4 Bug 208: inital CalDAV support for Symbian
Maximilian Odendahl <maximilian.odendahl@sun.com>
parents:
diff changeset
   408
	iTrans.SubmitL();
4927282092b4 Bug 208: inital CalDAV support for Symbian
Maximilian Odendahl <maximilian.odendahl@sun.com>
parents:
diff changeset
   409
4927282092b4 Bug 208: inital CalDAV support for Symbian
Maximilian Odendahl <maximilian.odendahl@sun.com>
parents:
diff changeset
   410
	CActiveScheduler::Start();
4927282092b4 Bug 208: inital CalDAV support for Symbian
Maximilian Odendahl <maximilian.odendahl@sun.com>
parents:
diff changeset
   411
4927282092b4 Bug 208: inital CalDAV support for Symbian
Maximilian Odendahl <maximilian.odendahl@sun.com>
parents:
diff changeset
   412
	options.Close();
4927282092b4 Bug 208: inital CalDAV support for Symbian
Maximilian Odendahl <maximilian.odendahl@sun.com>
parents:
diff changeset
   413
4927282092b4 Bug 208: inital CalDAV support for Symbian
Maximilian Odendahl <maximilian.odendahl@sun.com>
parents:
diff changeset
   414
	iAction = EActionNone;
4927282092b4 Bug 208: inital CalDAV support for Symbian
Maximilian Odendahl <maximilian.odendahl@sun.com>
parents:
diff changeset
   415
	return iReturnCode;
4927282092b4 Bug 208: inital CalDAV support for Symbian
Maximilian Odendahl <maximilian.odendahl@sun.com>
parents:
diff changeset
   416
	}
4927282092b4 Bug 208: inital CalDAV support for Symbian
Maximilian Odendahl <maximilian.odendahl@sun.com>
parents:
diff changeset
   417
4927282092b4 Bug 208: inital CalDAV support for Symbian
Maximilian Odendahl <maximilian.odendahl@sun.com>
parents:
diff changeset
   418
/**
4927282092b4 Bug 208: inital CalDAV support for Symbian
Maximilian Odendahl <maximilian.odendahl@sun.com>
parents:
diff changeset
   419
 * CHttpClient::GetNextDataPart
4927282092b4 Bug 208: inital CalDAV support for Symbian
Maximilian Odendahl <maximilian.odendahl@sun.com>
parents:
diff changeset
   420
 * GetNextDataPart callback
4927282092b4 Bug 208: inital CalDAV support for Symbian
Maximilian Odendahl <maximilian.odendahl@sun.com>
parents:
diff changeset
   421
 */
4927282092b4 Bug 208: inital CalDAV support for Symbian
Maximilian Odendahl <maximilian.odendahl@sun.com>
parents:
diff changeset
   422
TBool CHttpClient::GetNextDataPart(TPtrC8& aDataPart)
4927282092b4 Bug 208: inital CalDAV support for Symbian
Maximilian Odendahl <maximilian.odendahl@sun.com>
parents:
diff changeset
   423
	{
4927282092b4 Bug 208: inital CalDAV support for Symbian
Maximilian Odendahl <maximilian.odendahl@sun.com>
parents:
diff changeset
   424
	aDataPart.Set(iBodyRequest->Des());
4927282092b4 Bug 208: inital CalDAV support for Symbian
Maximilian Odendahl <maximilian.odendahl@sun.com>
parents:
diff changeset
   425
	return ETrue;
4927282092b4 Bug 208: inital CalDAV support for Symbian
Maximilian Odendahl <maximilian.odendahl@sun.com>
parents:
diff changeset
   426
	}
4927282092b4 Bug 208: inital CalDAV support for Symbian
Maximilian Odendahl <maximilian.odendahl@sun.com>
parents:
diff changeset
   427
4927282092b4 Bug 208: inital CalDAV support for Symbian
Maximilian Odendahl <maximilian.odendahl@sun.com>
parents:
diff changeset
   428
/**
4927282092b4 Bug 208: inital CalDAV support for Symbian
Maximilian Odendahl <maximilian.odendahl@sun.com>
parents:
diff changeset
   429
 * CHttpClient::ReleaseData
4927282092b4 Bug 208: inital CalDAV support for Symbian
Maximilian Odendahl <maximilian.odendahl@sun.com>
parents:
diff changeset
   430
 * ReleaseData callback
4927282092b4 Bug 208: inital CalDAV support for Symbian
Maximilian Odendahl <maximilian.odendahl@sun.com>
parents:
diff changeset
   431
 */
4927282092b4 Bug 208: inital CalDAV support for Symbian
Maximilian Odendahl <maximilian.odendahl@sun.com>
parents:
diff changeset
   432
void CHttpClient::ReleaseData()
4927282092b4 Bug 208: inital CalDAV support for Symbian
Maximilian Odendahl <maximilian.odendahl@sun.com>
parents:
diff changeset
   433
	{
4927282092b4 Bug 208: inital CalDAV support for Symbian
Maximilian Odendahl <maximilian.odendahl@sun.com>
parents:
diff changeset
   434
	}
4927282092b4 Bug 208: inital CalDAV support for Symbian
Maximilian Odendahl <maximilian.odendahl@sun.com>
parents:
diff changeset
   435
4927282092b4 Bug 208: inital CalDAV support for Symbian
Maximilian Odendahl <maximilian.odendahl@sun.com>
parents:
diff changeset
   436
/**
4927282092b4 Bug 208: inital CalDAV support for Symbian
Maximilian Odendahl <maximilian.odendahl@sun.com>
parents:
diff changeset
   437
 * CHttpClient::OverallDataSize
4927282092b4 Bug 208: inital CalDAV support for Symbian
Maximilian Odendahl <maximilian.odendahl@sun.com>
parents:
diff changeset
   438
 * OverallDataSize callback
4927282092b4 Bug 208: inital CalDAV support for Symbian
Maximilian Odendahl <maximilian.odendahl@sun.com>
parents:
diff changeset
   439
 */
4927282092b4 Bug 208: inital CalDAV support for Symbian
Maximilian Odendahl <maximilian.odendahl@sun.com>
parents:
diff changeset
   440
TInt CHttpClient::OverallDataSize()
4927282092b4 Bug 208: inital CalDAV support for Symbian
Maximilian Odendahl <maximilian.odendahl@sun.com>
parents:
diff changeset
   441
	{
4927282092b4 Bug 208: inital CalDAV support for Symbian
Maximilian Odendahl <maximilian.odendahl@sun.com>
parents:
diff changeset
   442
	if (iBodyRequest)
4927282092b4 Bug 208: inital CalDAV support for Symbian
Maximilian Odendahl <maximilian.odendahl@sun.com>
parents:
diff changeset
   443
		return iBodyRequest->Length();
4927282092b4 Bug 208: inital CalDAV support for Symbian
Maximilian Odendahl <maximilian.odendahl@sun.com>
parents:
diff changeset
   444
	else
4927282092b4 Bug 208: inital CalDAV support for Symbian
Maximilian Odendahl <maximilian.odendahl@sun.com>
parents:
diff changeset
   445
		return 0;
4927282092b4 Bug 208: inital CalDAV support for Symbian
Maximilian Odendahl <maximilian.odendahl@sun.com>
parents:
diff changeset
   446
	}
4927282092b4 Bug 208: inital CalDAV support for Symbian
Maximilian Odendahl <maximilian.odendahl@sun.com>
parents:
diff changeset
   447
4927282092b4 Bug 208: inital CalDAV support for Symbian
Maximilian Odendahl <maximilian.odendahl@sun.com>
parents:
diff changeset
   448
/**
4927282092b4 Bug 208: inital CalDAV support for Symbian
Maximilian Odendahl <maximilian.odendahl@sun.com>
parents:
diff changeset
   449
 * CHttpClient::Reset
4927282092b4 Bug 208: inital CalDAV support for Symbian
Maximilian Odendahl <maximilian.odendahl@sun.com>
parents:
diff changeset
   450
 * Reset callback
4927282092b4 Bug 208: inital CalDAV support for Symbian
Maximilian Odendahl <maximilian.odendahl@sun.com>
parents:
diff changeset
   451
 */
4927282092b4 Bug 208: inital CalDAV support for Symbian
Maximilian Odendahl <maximilian.odendahl@sun.com>
parents:
diff changeset
   452
TInt CHttpClient::Reset()
4927282092b4 Bug 208: inital CalDAV support for Symbian
Maximilian Odendahl <maximilian.odendahl@sun.com>
parents:
diff changeset
   453
	{
4927282092b4 Bug 208: inital CalDAV support for Symbian
Maximilian Odendahl <maximilian.odendahl@sun.com>
parents:
diff changeset
   454
	return KErrNone;
4927282092b4 Bug 208: inital CalDAV support for Symbian
Maximilian Odendahl <maximilian.odendahl@sun.com>
parents:
diff changeset
   455
	}
4927282092b4 Bug 208: inital CalDAV support for Symbian
Maximilian Odendahl <maximilian.odendahl@sun.com>
parents:
diff changeset
   456
4927282092b4 Bug 208: inital CalDAV support for Symbian
Maximilian Odendahl <maximilian.odendahl@sun.com>
parents:
diff changeset
   457
/**
4927282092b4 Bug 208: inital CalDAV support for Symbian
Maximilian Odendahl <maximilian.odendahl@sun.com>
parents:
diff changeset
   458
 * CHttpClient::SetHeaderL
4927282092b4 Bug 208: inital CalDAV support for Symbian
Maximilian Odendahl <maximilian.odendahl@sun.com>
parents:
diff changeset
   459
 * sets int header at session headers 
4927282092b4 Bug 208: inital CalDAV support for Symbian
Maximilian Odendahl <maximilian.odendahl@sun.com>
parents:
diff changeset
   460
 */
4927282092b4 Bug 208: inital CalDAV support for Symbian
Maximilian Odendahl <maximilian.odendahl@sun.com>
parents:
diff changeset
   461
void CHttpClient::SetHeaderL(RHTTPHeaders aHeaders, TInt aHdrField,
4927282092b4 Bug 208: inital CalDAV support for Symbian
Maximilian Odendahl <maximilian.odendahl@sun.com>
parents:
diff changeset
   462
		const TDesC8& aHdrValue)
4927282092b4 Bug 208: inital CalDAV support for Symbian
Maximilian Odendahl <maximilian.odendahl@sun.com>
parents:
diff changeset
   463
	{
4927282092b4 Bug 208: inital CalDAV support for Symbian
Maximilian Odendahl <maximilian.odendahl@sun.com>
parents:
diff changeset
   464
	RStringF valStr = iSess.StringPool().OpenFStringL(aHdrValue);
4927282092b4 Bug 208: inital CalDAV support for Symbian
Maximilian Odendahl <maximilian.odendahl@sun.com>
parents:
diff changeset
   465
	CleanupClosePushL(valStr);
4927282092b4 Bug 208: inital CalDAV support for Symbian
Maximilian Odendahl <maximilian.odendahl@sun.com>
parents:
diff changeset
   466
	THTTPHdrVal val(valStr);
4927282092b4 Bug 208: inital CalDAV support for Symbian
Maximilian Odendahl <maximilian.odendahl@sun.com>
parents:
diff changeset
   467
	aHeaders.SetFieldL(iSess.StringPool().StringF(aHdrField,
4927282092b4 Bug 208: inital CalDAV support for Symbian
Maximilian Odendahl <maximilian.odendahl@sun.com>
parents:
diff changeset
   468
			RHTTPSession::GetTable()), val);
4927282092b4 Bug 208: inital CalDAV support for Symbian
Maximilian Odendahl <maximilian.odendahl@sun.com>
parents:
diff changeset
   469
	CleanupStack::PopAndDestroy(&valStr);
4927282092b4 Bug 208: inital CalDAV support for Symbian
Maximilian Odendahl <maximilian.odendahl@sun.com>
parents:
diff changeset
   470
	}
4927282092b4 Bug 208: inital CalDAV support for Symbian
Maximilian Odendahl <maximilian.odendahl@sun.com>
parents:
diff changeset
   471
4927282092b4 Bug 208: inital CalDAV support for Symbian
Maximilian Odendahl <maximilian.odendahl@sun.com>
parents:
diff changeset
   472
/**
4927282092b4 Bug 208: inital CalDAV support for Symbian
Maximilian Odendahl <maximilian.odendahl@sun.com>
parents:
diff changeset
   473
 * CHttpClient::SetHeaderL
4927282092b4 Bug 208: inital CalDAV support for Symbian
Maximilian Odendahl <maximilian.odendahl@sun.com>
parents:
diff changeset
   474
 * set string header at session headers
4927282092b4 Bug 208: inital CalDAV support for Symbian
Maximilian Odendahl <maximilian.odendahl@sun.com>
parents:
diff changeset
   475
 */
4927282092b4 Bug 208: inital CalDAV support for Symbian
Maximilian Odendahl <maximilian.odendahl@sun.com>
parents:
diff changeset
   476
void CHttpClient::SetHeaderL(RHTTPHeaders aHeaders, const TDesC8 &aField,
4927282092b4 Bug 208: inital CalDAV support for Symbian
Maximilian Odendahl <maximilian.odendahl@sun.com>
parents:
diff changeset
   477
		const TDesC8 &aValue)
4927282092b4 Bug 208: inital CalDAV support for Symbian
Maximilian Odendahl <maximilian.odendahl@sun.com>
parents:
diff changeset
   478
	{
4927282092b4 Bug 208: inital CalDAV support for Symbian
Maximilian Odendahl <maximilian.odendahl@sun.com>
parents:
diff changeset
   479
	RStringF FieldVal = iSess.StringPool().OpenFStringL(aField);
4927282092b4 Bug 208: inital CalDAV support for Symbian
Maximilian Odendahl <maximilian.odendahl@sun.com>
parents:
diff changeset
   480
	CleanupClosePushL(FieldVal);
4927282092b4 Bug 208: inital CalDAV support for Symbian
Maximilian Odendahl <maximilian.odendahl@sun.com>
parents:
diff changeset
   481
	RStringF valStr = iSess.StringPool().OpenFStringL(aValue);
4927282092b4 Bug 208: inital CalDAV support for Symbian
Maximilian Odendahl <maximilian.odendahl@sun.com>
parents:
diff changeset
   482
	CleanupClosePushL(valStr);
4927282092b4 Bug 208: inital CalDAV support for Symbian
Maximilian Odendahl <maximilian.odendahl@sun.com>
parents:
diff changeset
   483
	THTTPHdrVal val(valStr);
4927282092b4 Bug 208: inital CalDAV support for Symbian
Maximilian Odendahl <maximilian.odendahl@sun.com>
parents:
diff changeset
   484
	aHeaders.SetFieldL(FieldVal, val);
4927282092b4 Bug 208: inital CalDAV support for Symbian
Maximilian Odendahl <maximilian.odendahl@sun.com>
parents:
diff changeset
   485
	CleanupStack::PopAndDestroy(&valStr);
4927282092b4 Bug 208: inital CalDAV support for Symbian
Maximilian Odendahl <maximilian.odendahl@sun.com>
parents:
diff changeset
   486
	CleanupStack::PopAndDestroy(&FieldVal);
4927282092b4 Bug 208: inital CalDAV support for Symbian
Maximilian Odendahl <maximilian.odendahl@sun.com>
parents:
diff changeset
   487
	}
4927282092b4 Bug 208: inital CalDAV support for Symbian
Maximilian Odendahl <maximilian.odendahl@sun.com>
parents:
diff changeset
   488
4927282092b4 Bug 208: inital CalDAV support for Symbian
Maximilian Odendahl <maximilian.odendahl@sun.com>
parents:
diff changeset
   489
/**
4927282092b4 Bug 208: inital CalDAV support for Symbian
Maximilian Odendahl <maximilian.odendahl@sun.com>
parents:
diff changeset
   490
 * CHttpClient::GetCredentialsL
4927282092b4 Bug 208: inital CalDAV support for Symbian
Maximilian Odendahl <maximilian.odendahl@sun.com>
parents:
diff changeset
   491
 * ask for username and password for authentification
4927282092b4 Bug 208: inital CalDAV support for Symbian
Maximilian Odendahl <maximilian.odendahl@sun.com>
parents:
diff changeset
   492
 */
4927282092b4 Bug 208: inital CalDAV support for Symbian
Maximilian Odendahl <maximilian.odendahl@sun.com>
parents:
diff changeset
   493
TBool CHttpClient::GetCredentialsL(const TUriC8& /*aURI*/, RString aRealm,
4927282092b4 Bug 208: inital CalDAV support for Symbian
Maximilian Odendahl <maximilian.odendahl@sun.com>
parents:
diff changeset
   494
		RStringF /*aAuthenticationType*/, RString& aUsername,
4927282092b4 Bug 208: inital CalDAV support for Symbian
Maximilian Odendahl <maximilian.odendahl@sun.com>
parents:
diff changeset
   495
		RString& aPassword)
4927282092b4 Bug 208: inital CalDAV support for Symbian
Maximilian Odendahl <maximilian.odendahl@sun.com>
parents:
diff changeset
   496
	{
4927282092b4 Bug 208: inital CalDAV support for Symbian
Maximilian Odendahl <maximilian.odendahl@sun.com>
parents:
diff changeset
   497
	if (iCredentialCount)
4927282092b4 Bug 208: inital CalDAV support for Symbian
Maximilian Odendahl <maximilian.odendahl@sun.com>
parents:
diff changeset
   498
		{
4927282092b4 Bug 208: inital CalDAV support for Symbian
Maximilian Odendahl <maximilian.odendahl@sun.com>
parents:
diff changeset
   499
		iCredentialCount = 0;
4927282092b4 Bug 208: inital CalDAV support for Symbian
Maximilian Odendahl <maximilian.odendahl@sun.com>
parents:
diff changeset
   500
		User::Leave(KErrAccessDenied);
4927282092b4 Bug 208: inital CalDAV support for Symbian
Maximilian Odendahl <maximilian.odendahl@sun.com>
parents:
diff changeset
   501
		}
4927282092b4 Bug 208: inital CalDAV support for Symbian
Maximilian Odendahl <maximilian.odendahl@sun.com>
parents:
diff changeset
   502
	iCredentialCount++;
4927282092b4 Bug 208: inital CalDAV support for Symbian
Maximilian Odendahl <maximilian.odendahl@sun.com>
parents:
diff changeset
   503
	aUsername = aRealm.Pool().OpenStringL(*iUser);
4927282092b4 Bug 208: inital CalDAV support for Symbian
Maximilian Odendahl <maximilian.odendahl@sun.com>
parents:
diff changeset
   504
	aPassword = aRealm.Pool().OpenStringL(*iPassword);
4927282092b4 Bug 208: inital CalDAV support for Symbian
Maximilian Odendahl <maximilian.odendahl@sun.com>
parents:
diff changeset
   505
	return ETrue;
4927282092b4 Bug 208: inital CalDAV support for Symbian
Maximilian Odendahl <maximilian.odendahl@sun.com>
parents:
diff changeset
   506
	}
4927282092b4 Bug 208: inital CalDAV support for Symbian
Maximilian Odendahl <maximilian.odendahl@sun.com>
parents:
diff changeset
   507
4927282092b4 Bug 208: inital CalDAV support for Symbian
Maximilian Odendahl <maximilian.odendahl@sun.com>
parents:
diff changeset
   508
/**
4927282092b4 Bug 208: inital CalDAV support for Symbian
Maximilian Odendahl <maximilian.odendahl@sun.com>
parents:
diff changeset
   509
 * CHttpClient::GetEtagHeaderL
4927282092b4 Bug 208: inital CalDAV support for Symbian
Maximilian Odendahl <maximilian.odendahl@sun.com>
parents:
diff changeset
   510
 * check for ETag and save it
4927282092b4 Bug 208: inital CalDAV support for Symbian
Maximilian Odendahl <maximilian.odendahl@sun.com>
parents:
diff changeset
   511
 */
4927282092b4 Bug 208: inital CalDAV support for Symbian
Maximilian Odendahl <maximilian.odendahl@sun.com>
parents:
diff changeset
   512
void CHttpClient::GetEtagHeaderL(RHTTPTransaction &aTransaction)
4927282092b4 Bug 208: inital CalDAV support for Symbian
Maximilian Odendahl <maximilian.odendahl@sun.com>
parents:
diff changeset
   513
	{
4927282092b4 Bug 208: inital CalDAV support for Symbian
Maximilian Odendahl <maximilian.odendahl@sun.com>
parents:
diff changeset
   514
	RStringF Header = aTransaction.Session().StringPool().StringF(HTTP::EETag,
4927282092b4 Bug 208: inital CalDAV support for Symbian
Maximilian Odendahl <maximilian.odendahl@sun.com>
parents:
diff changeset
   515
			RHTTPSession::GetTable());
4927282092b4 Bug 208: inital CalDAV support for Symbian
Maximilian Odendahl <maximilian.odendahl@sun.com>
parents:
diff changeset
   516
	THTTPHdrVal HeaderVal;
4927282092b4 Bug 208: inital CalDAV support for Symbian
Maximilian Odendahl <maximilian.odendahl@sun.com>
parents:
diff changeset
   517
	if (aTransaction.Response().GetHeaderCollection().GetField(Header, 0,
4927282092b4 Bug 208: inital CalDAV support for Symbian
Maximilian Odendahl <maximilian.odendahl@sun.com>
parents:
diff changeset
   518
			HeaderVal) == KErrNone)
4927282092b4 Bug 208: inital CalDAV support for Symbian
Maximilian Odendahl <maximilian.odendahl@sun.com>
parents:
diff changeset
   519
		{
4927282092b4 Bug 208: inital CalDAV support for Symbian
Maximilian Odendahl <maximilian.odendahl@sun.com>
parents:
diff changeset
   520
		RStringF FieldValStr = aTransaction.Session().StringPool().StringF(
4927282092b4 Bug 208: inital CalDAV support for Symbian
Maximilian Odendahl <maximilian.odendahl@sun.com>
parents:
diff changeset
   521
				HeaderVal.StrF());
4927282092b4 Bug 208: inital CalDAV support for Symbian
Maximilian Odendahl <maximilian.odendahl@sun.com>
parents:
diff changeset
   522
		const TDesC8 &FieldValDesC = FieldValStr.DesC();
4927282092b4 Bug 208: inital CalDAV support for Symbian
Maximilian Odendahl <maximilian.odendahl@sun.com>
parents:
diff changeset
   523
		delete iEtag;
4927282092b4 Bug 208: inital CalDAV support for Symbian
Maximilian Odendahl <maximilian.odendahl@sun.com>
parents:
diff changeset
   524
		iEtag = NULL;
4927282092b4 Bug 208: inital CalDAV support for Symbian
Maximilian Odendahl <maximilian.odendahl@sun.com>
parents:
diff changeset
   525
		iEtag = FieldValDesC.AllocL();
4927282092b4 Bug 208: inital CalDAV support for Symbian
Maximilian Odendahl <maximilian.odendahl@sun.com>
parents:
diff changeset
   526
		}
4927282092b4 Bug 208: inital CalDAV support for Symbian
Maximilian Odendahl <maximilian.odendahl@sun.com>
parents:
diff changeset
   527
	}
4927282092b4 Bug 208: inital CalDAV support for Symbian
Maximilian Odendahl <maximilian.odendahl@sun.com>
parents:
diff changeset
   528
4927282092b4 Bug 208: inital CalDAV support for Symbian
Maximilian Odendahl <maximilian.odendahl@sun.com>
parents:
diff changeset
   529
/**
4927282092b4 Bug 208: inital CalDAV support for Symbian
Maximilian Odendahl <maximilian.odendahl@sun.com>
parents:
diff changeset
   530
 * CHttpClient::MHFRunL
4927282092b4 Bug 208: inital CalDAV support for Symbian
Maximilian Odendahl <maximilian.odendahl@sun.com>
parents:
diff changeset
   531
 * http state machine callback
4927282092b4 Bug 208: inital CalDAV support for Symbian
Maximilian Odendahl <maximilian.odendahl@sun.com>
parents:
diff changeset
   532
 */
4927282092b4 Bug 208: inital CalDAV support for Symbian
Maximilian Odendahl <maximilian.odendahl@sun.com>
parents:
diff changeset
   533
void CHttpClient::MHFRunL(RHTTPTransaction aTransaction,
4927282092b4 Bug 208: inital CalDAV support for Symbian
Maximilian Odendahl <maximilian.odendahl@sun.com>
parents:
diff changeset
   534
		const THTTPEvent& aEvent)
4927282092b4 Bug 208: inital CalDAV support for Symbian
Maximilian Odendahl <maximilian.odendahl@sun.com>
parents:
diff changeset
   535
	{
4927282092b4 Bug 208: inital CalDAV support for Symbian
Maximilian Odendahl <maximilian.odendahl@sun.com>
parents:
diff changeset
   536
	switch (aEvent.iStatus)
4927282092b4 Bug 208: inital CalDAV support for Symbian
Maximilian Odendahl <maximilian.odendahl@sun.com>
parents:
diff changeset
   537
		{
4927282092b4 Bug 208: inital CalDAV support for Symbian
Maximilian Odendahl <maximilian.odendahl@sun.com>
parents:
diff changeset
   538
		case THTTPEvent::EGotResponseHeaders:
4927282092b4 Bug 208: inital CalDAV support for Symbian
Maximilian Odendahl <maximilian.odendahl@sun.com>
parents:
diff changeset
   539
			{
4927282092b4 Bug 208: inital CalDAV support for Symbian
Maximilian Odendahl <maximilian.odendahl@sun.com>
parents:
diff changeset
   540
			// HTTP response headers have been received. We can determine now if there is
4927282092b4 Bug 208: inital CalDAV support for Symbian
Maximilian Odendahl <maximilian.odendahl@sun.com>
parents:
diff changeset
   541
			// going to be a response body to save.
4927282092b4 Bug 208: inital CalDAV support for Symbian
Maximilian Odendahl <maximilian.odendahl@sun.com>
parents:
diff changeset
   542
			RHTTPResponse resp = aTransaction.Response();
4927282092b4 Bug 208: inital CalDAV support for Symbian
Maximilian Odendahl <maximilian.odendahl@sun.com>
parents:
diff changeset
   543
			iReturnCode = resp.StatusCode();
4927282092b4 Bug 208: inital CalDAV support for Symbian
Maximilian Odendahl <maximilian.odendahl@sun.com>
parents:
diff changeset
   544
4927282092b4 Bug 208: inital CalDAV support for Symbian
Maximilian Odendahl <maximilian.odendahl@sun.com>
parents:
diff changeset
   545
			if (iAction == EActionOption)
4927282092b4 Bug 208: inital CalDAV support for Symbian
Maximilian Odendahl <maximilian.odendahl@sun.com>
parents:
diff changeset
   546
				{
4927282092b4 Bug 208: inital CalDAV support for Symbian
Maximilian Odendahl <maximilian.odendahl@sun.com>
parents:
diff changeset
   547
				CalDavUtils::ScanAllowHeaderL(aTransaction, *iOptions);
4927282092b4 Bug 208: inital CalDAV support for Symbian
Maximilian Odendahl <maximilian.odendahl@sun.com>
parents:
diff changeset
   548
				CalDavUtils::ScanDAVHeaderL(aTransaction, *iOptions);
4927282092b4 Bug 208: inital CalDAV support for Symbian
Maximilian Odendahl <maximilian.odendahl@sun.com>
parents:
diff changeset
   549
				}
4927282092b4 Bug 208: inital CalDAV support for Symbian
Maximilian Odendahl <maximilian.odendahl@sun.com>
parents:
diff changeset
   550
4927282092b4 Bug 208: inital CalDAV support for Symbian
Maximilian Odendahl <maximilian.odendahl@sun.com>
parents:
diff changeset
   551
			GetEtagHeaderL(aTransaction);
4927282092b4 Bug 208: inital CalDAV support for Symbian
Maximilian Odendahl <maximilian.odendahl@sun.com>
parents:
diff changeset
   552
			
4927282092b4 Bug 208: inital CalDAV support for Symbian
Maximilian Odendahl <maximilian.odendahl@sun.com>
parents:
diff changeset
   553
			TBool cancelling = ETrue;
4927282092b4 Bug 208: inital CalDAV support for Symbian
Maximilian Odendahl <maximilian.odendahl@sun.com>
parents:
diff changeset
   554
			if (resp.HasBody() && (iReturnCode >= OK) && (iReturnCode
4927282092b4 Bug 208: inital CalDAV support for Symbian
Maximilian Odendahl <maximilian.odendahl@sun.com>
parents:
diff changeset
   555
					< MUTIPLECHOICES))
4927282092b4 Bug 208: inital CalDAV support for Symbian
Maximilian Odendahl <maximilian.odendahl@sun.com>
parents:
diff changeset
   556
				cancelling = EFalse;
4927282092b4 Bug 208: inital CalDAV support for Symbian
Maximilian Odendahl <maximilian.odendahl@sun.com>
parents:
diff changeset
   557
4927282092b4 Bug 208: inital CalDAV support for Symbian
Maximilian Odendahl <maximilian.odendahl@sun.com>
parents:
diff changeset
   558
			if (cancelling)
4927282092b4 Bug 208: inital CalDAV support for Symbian
Maximilian Odendahl <maximilian.odendahl@sun.com>
parents:
diff changeset
   559
				{
4927282092b4 Bug 208: inital CalDAV support for Symbian
Maximilian Odendahl <maximilian.odendahl@sun.com>
parents:
diff changeset
   560
				aTransaction.Close();
4927282092b4 Bug 208: inital CalDAV support for Symbian
Maximilian Odendahl <maximilian.odendahl@sun.com>
parents:
diff changeset
   561
				CActiveScheduler::Stop();
4927282092b4 Bug 208: inital CalDAV support for Symbian
Maximilian Odendahl <maximilian.odendahl@sun.com>
parents:
diff changeset
   562
				}
4927282092b4 Bug 208: inital CalDAV support for Symbian
Maximilian Odendahl <maximilian.odendahl@sun.com>
parents:
diff changeset
   563
			}
4927282092b4 Bug 208: inital CalDAV support for Symbian
Maximilian Odendahl <maximilian.odendahl@sun.com>
parents:
diff changeset
   564
			break;
4927282092b4 Bug 208: inital CalDAV support for Symbian
Maximilian Odendahl <maximilian.odendahl@sun.com>
parents:
diff changeset
   565
		case THTTPEvent::EGotResponseBodyData:
4927282092b4 Bug 208: inital CalDAV support for Symbian
Maximilian Odendahl <maximilian.odendahl@sun.com>
parents:
diff changeset
   566
			{
4927282092b4 Bug 208: inital CalDAV support for Symbian
Maximilian Odendahl <maximilian.odendahl@sun.com>
parents:
diff changeset
   567
			// Get the body data supplier
4927282092b4 Bug 208: inital CalDAV support for Symbian
Maximilian Odendahl <maximilian.odendahl@sun.com>
parents:
diff changeset
   568
			MHTTPDataSupplier* body = aTransaction.Response().Body();
4927282092b4 Bug 208: inital CalDAV support for Symbian
Maximilian Odendahl <maximilian.odendahl@sun.com>
parents:
diff changeset
   569
			TPtrC8 dataChunk;
4927282092b4 Bug 208: inital CalDAV support for Symbian
Maximilian Odendahl <maximilian.odendahl@sun.com>
parents:
diff changeset
   570
			TBool isLast = body->GetNextDataPart(dataChunk);
4927282092b4 Bug 208: inital CalDAV support for Symbian
Maximilian Odendahl <maximilian.odendahl@sun.com>
parents:
diff changeset
   571
			if (iBodyResponse)
4927282092b4 Bug 208: inital CalDAV support for Symbian
Maximilian Odendahl <maximilian.odendahl@sun.com>
parents:
diff changeset
   572
				iBodyResponse->InsertL(iBodyResponse->Size(), dataChunk);
4927282092b4 Bug 208: inital CalDAV support for Symbian
Maximilian Odendahl <maximilian.odendahl@sun.com>
parents:
diff changeset
   573
			// Done with that bit of body data
4927282092b4 Bug 208: inital CalDAV support for Symbian
Maximilian Odendahl <maximilian.odendahl@sun.com>
parents:
diff changeset
   574
			body->ReleaseData();
4927282092b4 Bug 208: inital CalDAV support for Symbian
Maximilian Odendahl <maximilian.odendahl@sun.com>
parents:
diff changeset
   575
			}
4927282092b4 Bug 208: inital CalDAV support for Symbian
Maximilian Odendahl <maximilian.odendahl@sun.com>
parents:
diff changeset
   576
			break;
4927282092b4 Bug 208: inital CalDAV support for Symbian
Maximilian Odendahl <maximilian.odendahl@sun.com>
parents:
diff changeset
   577
		case THTTPEvent::EResponseComplete:
4927282092b4 Bug 208: inital CalDAV support for Symbian
Maximilian Odendahl <maximilian.odendahl@sun.com>
parents:
diff changeset
   578
			{
4927282092b4 Bug 208: inital CalDAV support for Symbian
Maximilian Odendahl <maximilian.odendahl@sun.com>
parents:
diff changeset
   579
			// The transaction's response is complete
4927282092b4 Bug 208: inital CalDAV support for Symbian
Maximilian Odendahl <maximilian.odendahl@sun.com>
parents:
diff changeset
   580
			}
4927282092b4 Bug 208: inital CalDAV support for Symbian
Maximilian Odendahl <maximilian.odendahl@sun.com>
parents:
diff changeset
   581
			break;
4927282092b4 Bug 208: inital CalDAV support for Symbian
Maximilian Odendahl <maximilian.odendahl@sun.com>
parents:
diff changeset
   582
		case THTTPEvent::ESucceeded:
4927282092b4 Bug 208: inital CalDAV support for Symbian
Maximilian Odendahl <maximilian.odendahl@sun.com>
parents:
diff changeset
   583
			{
4927282092b4 Bug 208: inital CalDAV support for Symbian
Maximilian Odendahl <maximilian.odendahl@sun.com>
parents:
diff changeset
   584
			aTransaction.Close();
4927282092b4 Bug 208: inital CalDAV support for Symbian
Maximilian Odendahl <maximilian.odendahl@sun.com>
parents:
diff changeset
   585
			CActiveScheduler::Stop();
4927282092b4 Bug 208: inital CalDAV support for Symbian
Maximilian Odendahl <maximilian.odendahl@sun.com>
parents:
diff changeset
   586
			}
4927282092b4 Bug 208: inital CalDAV support for Symbian
Maximilian Odendahl <maximilian.odendahl@sun.com>
parents:
diff changeset
   587
			break;
4927282092b4 Bug 208: inital CalDAV support for Symbian
Maximilian Odendahl <maximilian.odendahl@sun.com>
parents:
diff changeset
   588
		case THTTPEvent::EFailed:
4927282092b4 Bug 208: inital CalDAV support for Symbian
Maximilian Odendahl <maximilian.odendahl@sun.com>
parents:
diff changeset
   589
			{
4927282092b4 Bug 208: inital CalDAV support for Symbian
Maximilian Odendahl <maximilian.odendahl@sun.com>
parents:
diff changeset
   590
			aTransaction.Close();
4927282092b4 Bug 208: inital CalDAV support for Symbian
Maximilian Odendahl <maximilian.odendahl@sun.com>
parents:
diff changeset
   591
			CActiveScheduler::Stop();
4927282092b4 Bug 208: inital CalDAV support for Symbian
Maximilian Odendahl <maximilian.odendahl@sun.com>
parents:
diff changeset
   592
			}
4927282092b4 Bug 208: inital CalDAV support for Symbian
Maximilian Odendahl <maximilian.odendahl@sun.com>
parents:
diff changeset
   593
			break;
4927282092b4 Bug 208: inital CalDAV support for Symbian
Maximilian Odendahl <maximilian.odendahl@sun.com>
parents:
diff changeset
   594
		case THTTPEvent::ERedirectedPermanently:
4927282092b4 Bug 208: inital CalDAV support for Symbian
Maximilian Odendahl <maximilian.odendahl@sun.com>
parents:
diff changeset
   595
			{
4927282092b4 Bug 208: inital CalDAV support for Symbian
Maximilian Odendahl <maximilian.odendahl@sun.com>
parents:
diff changeset
   596
			}
4927282092b4 Bug 208: inital CalDAV support for Symbian
Maximilian Odendahl <maximilian.odendahl@sun.com>
parents:
diff changeset
   597
			break;
4927282092b4 Bug 208: inital CalDAV support for Symbian
Maximilian Odendahl <maximilian.odendahl@sun.com>
parents:
diff changeset
   598
		case THTTPEvent::ERedirectedTemporarily:
4927282092b4 Bug 208: inital CalDAV support for Symbian
Maximilian Odendahl <maximilian.odendahl@sun.com>
parents:
diff changeset
   599
			{
4927282092b4 Bug 208: inital CalDAV support for Symbian
Maximilian Odendahl <maximilian.odendahl@sun.com>
parents:
diff changeset
   600
			}
4927282092b4 Bug 208: inital CalDAV support for Symbian
Maximilian Odendahl <maximilian.odendahl@sun.com>
parents:
diff changeset
   601
			break;
4927282092b4 Bug 208: inital CalDAV support for Symbian
Maximilian Odendahl <maximilian.odendahl@sun.com>
parents:
diff changeset
   602
		default:
4927282092b4 Bug 208: inital CalDAV support for Symbian
Maximilian Odendahl <maximilian.odendahl@sun.com>
parents:
diff changeset
   603
			{
4927282092b4 Bug 208: inital CalDAV support for Symbian
Maximilian Odendahl <maximilian.odendahl@sun.com>
parents:
diff changeset
   604
			// close off the transaction if it's an error
4927282092b4 Bug 208: inital CalDAV support for Symbian
Maximilian Odendahl <maximilian.odendahl@sun.com>
parents:
diff changeset
   605
			if (aEvent.iStatus < 0)
4927282092b4 Bug 208: inital CalDAV support for Symbian
Maximilian Odendahl <maximilian.odendahl@sun.com>
parents:
diff changeset
   606
				{
4927282092b4 Bug 208: inital CalDAV support for Symbian
Maximilian Odendahl <maximilian.odendahl@sun.com>
parents:
diff changeset
   607
				iReturnCode = aEvent.iStatus;
4927282092b4 Bug 208: inital CalDAV support for Symbian
Maximilian Odendahl <maximilian.odendahl@sun.com>
parents:
diff changeset
   608
				aTransaction.Close();
4927282092b4 Bug 208: inital CalDAV support for Symbian
Maximilian Odendahl <maximilian.odendahl@sun.com>
parents:
diff changeset
   609
				CActiveScheduler::Stop();
4927282092b4 Bug 208: inital CalDAV support for Symbian
Maximilian Odendahl <maximilian.odendahl@sun.com>
parents:
diff changeset
   610
				}
4927282092b4 Bug 208: inital CalDAV support for Symbian
Maximilian Odendahl <maximilian.odendahl@sun.com>
parents:
diff changeset
   611
			}
4927282092b4 Bug 208: inital CalDAV support for Symbian
Maximilian Odendahl <maximilian.odendahl@sun.com>
parents:
diff changeset
   612
			break;
4927282092b4 Bug 208: inital CalDAV support for Symbian
Maximilian Odendahl <maximilian.odendahl@sun.com>
parents:
diff changeset
   613
		}
4927282092b4 Bug 208: inital CalDAV support for Symbian
Maximilian Odendahl <maximilian.odendahl@sun.com>
parents:
diff changeset
   614
	}
4927282092b4 Bug 208: inital CalDAV support for Symbian
Maximilian Odendahl <maximilian.odendahl@sun.com>
parents:
diff changeset
   615
4927282092b4 Bug 208: inital CalDAV support for Symbian
Maximilian Odendahl <maximilian.odendahl@sun.com>
parents:
diff changeset
   616
/**
4927282092b4 Bug 208: inital CalDAV support for Symbian
Maximilian Odendahl <maximilian.odendahl@sun.com>
parents:
diff changeset
   617
 * CHttpClient::MHFRunError
4927282092b4 Bug 208: inital CalDAV support for Symbian
Maximilian Odendahl <maximilian.odendahl@sun.com>
parents:
diff changeset
   618
 * http stack erros
4927282092b4 Bug 208: inital CalDAV support for Symbian
Maximilian Odendahl <maximilian.odendahl@sun.com>
parents:
diff changeset
   619
 */
4927282092b4 Bug 208: inital CalDAV support for Symbian
Maximilian Odendahl <maximilian.odendahl@sun.com>
parents:
diff changeset
   620
TInt CHttpClient::MHFRunError(TInt aError, RHTTPTransaction /*aTransaction*/,
4927282092b4 Bug 208: inital CalDAV support for Symbian
Maximilian Odendahl <maximilian.odendahl@sun.com>
parents:
diff changeset
   621
		const THTTPEvent& /*aEvent*/)
4927282092b4 Bug 208: inital CalDAV support for Symbian
Maximilian Odendahl <maximilian.odendahl@sun.com>
parents:
diff changeset
   622
	{
4927282092b4 Bug 208: inital CalDAV support for Symbian
Maximilian Odendahl <maximilian.odendahl@sun.com>
parents:
diff changeset
   623
	iReturnCode = aError;
4927282092b4 Bug 208: inital CalDAV support for Symbian
Maximilian Odendahl <maximilian.odendahl@sun.com>
parents:
diff changeset
   624
	return KErrNone;
4927282092b4 Bug 208: inital CalDAV support for Symbian
Maximilian Odendahl <maximilian.odendahl@sun.com>
parents:
diff changeset
   625
	}
4927282092b4 Bug 208: inital CalDAV support for Symbian
Maximilian Odendahl <maximilian.odendahl@sun.com>
parents:
diff changeset
   626
4927282092b4 Bug 208: inital CalDAV support for Symbian
Maximilian Odendahl <maximilian.odendahl@sun.com>
parents:
diff changeset
   627
/**
4927282092b4 Bug 208: inital CalDAV support for Symbian
Maximilian Odendahl <maximilian.odendahl@sun.com>
parents:
diff changeset
   628
 * CHttpClient::SetUserL
4927282092b4 Bug 208: inital CalDAV support for Symbian
Maximilian Odendahl <maximilian.odendahl@sun.com>
parents:
diff changeset
   629
 * set username for authentification
4927282092b4 Bug 208: inital CalDAV support for Symbian
Maximilian Odendahl <maximilian.odendahl@sun.com>
parents:
diff changeset
   630
 */
4927282092b4 Bug 208: inital CalDAV support for Symbian
Maximilian Odendahl <maximilian.odendahl@sun.com>
parents:
diff changeset
   631
void CHttpClient::SetUserL(const TDesC8 &aUser)
4927282092b4 Bug 208: inital CalDAV support for Symbian
Maximilian Odendahl <maximilian.odendahl@sun.com>
parents:
diff changeset
   632
	{
4927282092b4 Bug 208: inital CalDAV support for Symbian
Maximilian Odendahl <maximilian.odendahl@sun.com>
parents:
diff changeset
   633
	if (iUser)
4927282092b4 Bug 208: inital CalDAV support for Symbian
Maximilian Odendahl <maximilian.odendahl@sun.com>
parents:
diff changeset
   634
		delete iUser;
4927282092b4 Bug 208: inital CalDAV support for Symbian
Maximilian Odendahl <maximilian.odendahl@sun.com>
parents:
diff changeset
   635
	iUser = aUser.Alloc();
4927282092b4 Bug 208: inital CalDAV support for Symbian
Maximilian Odendahl <maximilian.odendahl@sun.com>
parents:
diff changeset
   636
	iSess.Close();
4927282092b4 Bug 208: inital CalDAV support for Symbian
Maximilian Odendahl <maximilian.odendahl@sun.com>
parents:
diff changeset
   637
	OpenSessionL();
4927282092b4 Bug 208: inital CalDAV support for Symbian
Maximilian Odendahl <maximilian.odendahl@sun.com>
parents:
diff changeset
   638
	}
4927282092b4 Bug 208: inital CalDAV support for Symbian
Maximilian Odendahl <maximilian.odendahl@sun.com>
parents:
diff changeset
   639
4927282092b4 Bug 208: inital CalDAV support for Symbian
Maximilian Odendahl <maximilian.odendahl@sun.com>
parents:
diff changeset
   640
/**
4927282092b4 Bug 208: inital CalDAV support for Symbian
Maximilian Odendahl <maximilian.odendahl@sun.com>
parents:
diff changeset
   641
 * CHttpClient::SetPasswordL
4927282092b4 Bug 208: inital CalDAV support for Symbian
Maximilian Odendahl <maximilian.odendahl@sun.com>
parents:
diff changeset
   642
 * Set Password for authentification
4927282092b4 Bug 208: inital CalDAV support for Symbian
Maximilian Odendahl <maximilian.odendahl@sun.com>
parents:
diff changeset
   643
 */
4927282092b4 Bug 208: inital CalDAV support for Symbian
Maximilian Odendahl <maximilian.odendahl@sun.com>
parents:
diff changeset
   644
void CHttpClient::SetPasswordL(const TDesC8 &aPassword)
4927282092b4 Bug 208: inital CalDAV support for Symbian
Maximilian Odendahl <maximilian.odendahl@sun.com>
parents:
diff changeset
   645
	{
4927282092b4 Bug 208: inital CalDAV support for Symbian
Maximilian Odendahl <maximilian.odendahl@sun.com>
parents:
diff changeset
   646
	if (iPassword)
4927282092b4 Bug 208: inital CalDAV support for Symbian
Maximilian Odendahl <maximilian.odendahl@sun.com>
parents:
diff changeset
   647
		delete iPassword;
4927282092b4 Bug 208: inital CalDAV support for Symbian
Maximilian Odendahl <maximilian.odendahl@sun.com>
parents:
diff changeset
   648
	iPassword = aPassword.Alloc();
4927282092b4 Bug 208: inital CalDAV support for Symbian
Maximilian Odendahl <maximilian.odendahl@sun.com>
parents:
diff changeset
   649
	iSess.Close();
4927282092b4 Bug 208: inital CalDAV support for Symbian
Maximilian Odendahl <maximilian.odendahl@sun.com>
parents:
diff changeset
   650
	OpenSessionL();
4927282092b4 Bug 208: inital CalDAV support for Symbian
Maximilian Odendahl <maximilian.odendahl@sun.com>
parents:
diff changeset
   651
	}
4927282092b4 Bug 208: inital CalDAV support for Symbian
Maximilian Odendahl <maximilian.odendahl@sun.com>
parents:
diff changeset
   652
4927282092b4 Bug 208: inital CalDAV support for Symbian
Maximilian Odendahl <maximilian.odendahl@sun.com>
parents:
diff changeset
   653
/**
4927282092b4 Bug 208: inital CalDAV support for Symbian
Maximilian Odendahl <maximilian.odendahl@sun.com>
parents:
diff changeset
   654
 * CHttpClient::User
4927282092b4 Bug 208: inital CalDAV support for Symbian
Maximilian Odendahl <maximilian.odendahl@sun.com>
parents:
diff changeset
   655
 * get username
4927282092b4 Bug 208: inital CalDAV support for Symbian
Maximilian Odendahl <maximilian.odendahl@sun.com>
parents:
diff changeset
   656
 */
4927282092b4 Bug 208: inital CalDAV support for Symbian
Maximilian Odendahl <maximilian.odendahl@sun.com>
parents:
diff changeset
   657
TPtrC8 CHttpClient::User()
4927282092b4 Bug 208: inital CalDAV support for Symbian
Maximilian Odendahl <maximilian.odendahl@sun.com>
parents:
diff changeset
   658
	{
4927282092b4 Bug 208: inital CalDAV support for Symbian
Maximilian Odendahl <maximilian.odendahl@sun.com>
parents:
diff changeset
   659
	return iUser ? *iUser : KNullDesC8();
4927282092b4 Bug 208: inital CalDAV support for Symbian
Maximilian Odendahl <maximilian.odendahl@sun.com>
parents:
diff changeset
   660
	}
4927282092b4 Bug 208: inital CalDAV support for Symbian
Maximilian Odendahl <maximilian.odendahl@sun.com>
parents:
diff changeset
   661
4927282092b4 Bug 208: inital CalDAV support for Symbian
Maximilian Odendahl <maximilian.odendahl@sun.com>
parents:
diff changeset
   662
/**
4927282092b4 Bug 208: inital CalDAV support for Symbian
Maximilian Odendahl <maximilian.odendahl@sun.com>
parents:
diff changeset
   663
 * CHttpClient::Password
4927282092b4 Bug 208: inital CalDAV support for Symbian
Maximilian Odendahl <maximilian.odendahl@sun.com>
parents:
diff changeset
   664
 * get password
4927282092b4 Bug 208: inital CalDAV support for Symbian
Maximilian Odendahl <maximilian.odendahl@sun.com>
parents:
diff changeset
   665
 */
4927282092b4 Bug 208: inital CalDAV support for Symbian
Maximilian Odendahl <maximilian.odendahl@sun.com>
parents:
diff changeset
   666
TPtrC8 CHttpClient::Password()
4927282092b4 Bug 208: inital CalDAV support for Symbian
Maximilian Odendahl <maximilian.odendahl@sun.com>
parents:
diff changeset
   667
	{
4927282092b4 Bug 208: inital CalDAV support for Symbian
Maximilian Odendahl <maximilian.odendahl@sun.com>
parents:
diff changeset
   668
	return iPassword ? *iPassword : KNullDesC8();
4927282092b4 Bug 208: inital CalDAV support for Symbian
Maximilian Odendahl <maximilian.odendahl@sun.com>
parents:
diff changeset
   669
	}
4927282092b4 Bug 208: inital CalDAV support for Symbian
Maximilian Odendahl <maximilian.odendahl@sun.com>
parents:
diff changeset
   670
4927282092b4 Bug 208: inital CalDAV support for Symbian
Maximilian Odendahl <maximilian.odendahl@sun.com>
parents:
diff changeset
   671
/**
4927282092b4 Bug 208: inital CalDAV support for Symbian
Maximilian Odendahl <maximilian.odendahl@sun.com>
parents:
diff changeset
   672
 * CHttpClient::ReturnCode
4927282092b4 Bug 208: inital CalDAV support for Symbian
Maximilian Odendahl <maximilian.odendahl@sun.com>
parents:
diff changeset
   673
 * get returned HTTP code
4927282092b4 Bug 208: inital CalDAV support for Symbian
Maximilian Odendahl <maximilian.odendahl@sun.com>
parents:
diff changeset
   674
 */
4927282092b4 Bug 208: inital CalDAV support for Symbian
Maximilian Odendahl <maximilian.odendahl@sun.com>
parents:
diff changeset
   675
TInt CHttpClient::ReturnCode()
4927282092b4 Bug 208: inital CalDAV support for Symbian
Maximilian Odendahl <maximilian.odendahl@sun.com>
parents:
diff changeset
   676
	{
4927282092b4 Bug 208: inital CalDAV support for Symbian
Maximilian Odendahl <maximilian.odendahl@sun.com>
parents:
diff changeset
   677
	return iReturnCode;
4927282092b4 Bug 208: inital CalDAV support for Symbian
Maximilian Odendahl <maximilian.odendahl@sun.com>
parents:
diff changeset
   678
	}
4927282092b4 Bug 208: inital CalDAV support for Symbian
Maximilian Odendahl <maximilian.odendahl@sun.com>
parents:
diff changeset
   679
4927282092b4 Bug 208: inital CalDAV support for Symbian
Maximilian Odendahl <maximilian.odendahl@sun.com>
parents:
diff changeset
   680
/**
4927282092b4 Bug 208: inital CalDAV support for Symbian
Maximilian Odendahl <maximilian.odendahl@sun.com>
parents:
diff changeset
   681
 * CHttpClient::ETag
4927282092b4 Bug 208: inital CalDAV support for Symbian
Maximilian Odendahl <maximilian.odendahl@sun.com>
parents:
diff changeset
   682
 * get ETag
4927282092b4 Bug 208: inital CalDAV support for Symbian
Maximilian Odendahl <maximilian.odendahl@sun.com>
parents:
diff changeset
   683
 */
4927282092b4 Bug 208: inital CalDAV support for Symbian
Maximilian Odendahl <maximilian.odendahl@sun.com>
parents:
diff changeset
   684
TPtrC8 CHttpClient::ETag()
4927282092b4 Bug 208: inital CalDAV support for Symbian
Maximilian Odendahl <maximilian.odendahl@sun.com>
parents:
diff changeset
   685
	{
4927282092b4 Bug 208: inital CalDAV support for Symbian
Maximilian Odendahl <maximilian.odendahl@sun.com>
parents:
diff changeset
   686
	return iEtag ? *iEtag : KNullDesC8();
4927282092b4 Bug 208: inital CalDAV support for Symbian
Maximilian Odendahl <maximilian.odendahl@sun.com>
parents:
diff changeset
   687
	}