// ----------------------------------------------------------------------------- // CHttpCacheEntry::InternalizeL // // ----------------------------------------------------------------------------- // void CHttpCacheEntry::InternalizeL( RReadStream& aReadStream, const TDesC& aDirectory ) { // url length TInt len; len = aReadStream.ReadInt32L(); delete iUrl; iUrl=NULL; iUrl = HBufC8::NewL( len ); TPtr8 ptr8( iUrl->Des() ); // url aReadStream.ReadL( ptr8, len ); // calculate full path and filename length // aDirectory/ + "x/xxxxxxxx" : note aDirectory has trailing '/' len = aDirectory.Length() + KSubdirNameLength + KFilenameLength; HBufC* filename = HBufC::NewLC( len ); TPtr ptr( filename->Des() ); // Read max char length of filename. // NOTE: The filename and filename length is calculated by the code in // HttpCacheUtil::GenerateNameLC. The sub directory is the same as the // last char of the filename, e.g. ..\A\0123DCBA TBuf<KFilenameLength> uniqueFilename; aReadStream.ReadL( uniqueFilename , KFilenameLength ); TPtrC uniqueSubDir = uniqueFilename.Right(1); // assemble path and filename ptr.Format(_L("%S%S\\%S"), &aDirectory, &uniqueSubDir, &uniqueFilename); // SetFileNameL( filename->Des() ); // CleanupStack::PopAndDestroy(); // filename // la TReal64 la; la = aReadStream.ReadReal64L(); iLastAccessed = la; // ref iRef = aReadStream.ReadUint32L(); // size iBodySize = aReadStream.ReadUint32L( ); // size iHeaderSize = aReadStream.ReadUint32L( ); // protected iProtected = aReadStream.ReadInt32L(); // header data delete iHeaderBuffer; iHeaderBuffer = NULL; len = aReadStream.ReadInt32L(); iHeaderBuffer = HBufC8::NewL(len); TPtr8 header_ptr( iHeaderBuffer->Des() ); aReadStream.ReadL( header_ptr, len ); // SetState( ECacheComplete ); }
/** Set the drive on which to store the attachment */ EXPORT_C void CAgnAttachmentFile::SetDriveL(const TDesC& aDrive) { if ( ! iFileName || iFileName->Length() <= KMaxDriveName) { SetFileNameL(aDrive.Left(KMaxDriveName)); } else { if (iFileName->Left(1) != aDrive.Left(1)) { TPtr ptr(iFileName->Des()); ptr.Replace(0, aDrive.Length(), aDrive); } } }
//Used when an entry is copied void CAgnAttachmentFile::CopyL(const CAgnAttachment& aSource) { CAgnAttachment::CopyL(aSource); const CAgnAttachmentFile& KFileSource = static_cast<const CAgnAttachmentFile&>(aSource); delete iContentId; iContentId = NULL; if (KFileSource.ContentId().Length()) { iContentId = KFileSource.ContentId().AllocL(); } SetLastModifiedTimeUtc(KFileSource.LastModifiedTimeUtc()); SetFileNameL(KFileSource.FileName()); if (KFileSource.IsFileHandleSet()) { CopyFileHandle(KFileSource.FileHandle()); } }
void CTestTransaction::ConstructL(RHTTPSession& aSession) { TBool hasRequestBody = EFalse; switch (iTransactionType) { case HTTP::EPOST : case HTTP::EPUT : if (iFilename.Length() > 0) { User::LeaveIfError(SetFileNameL(iFilename)); hasRequestBody = ETrue; } break ; case HTTP::EGET : case HTTP::EDELETE: case HTTP::EHEAD: case HTTP::ECONNECT : default: ; } TUriParser8 KURI; KURI.Parse(iUri); RStringPool strPool = aSession.StringPool(); // open a transaction within the required session and use the class callback object for // managing the subsequent events... iTransaction = aSession.OpenTransactionL(KURI, *this, strPool.StringF(iTransactionType, RHTTPSession::GetTable())); iState = EActive; RHTTPRequest request = iTransaction.Request(); RHTTPHeaders headers = request.GetHeaderCollection(); AddAcceptHeaderL(headers, strPool); SetUserAgentL(headers, strPool); SetContentLengthL(headers, strPool); AcceptEncodingL(headers, strPool); // Check to see if pipelining should be disabled if (Machine()->GetDefine(KITHDisablePipelining).CompareF(KITHYes)==0) { RHTTPTransactionPropertySet transactionPropertySet = iTransaction.PropertySet(); RStringF name = strPool.StringF(HTTP::EHttpPipelining, RHTTPSession::GetTable()); RStringF value = strPool.StringF(HTTP::EDisablePipelining,RHTTPSession::GetTable()); transactionPropertySet.SetPropertyL(name,value); } // Add request body if (hasRequestBody) { if (!AddRequestBodyL(headers, strPool)) User::LeaveIfError(KErrArgument); } }