Hello I was tryng an http connection engine and the following line pops in the code .
Code:void CPMHttpEngine::DoPostL(/*const TDesC& connectUrl*/) { /*TBuf8<connectUrl.Length()> buf8; buf8.Copy(connectUrl);*/ TUriParser8 uri; // User::LeaveIfError(uri.Parse(buf8)); User::LeaveIfError(uri.Parse(iUrl)); // Get request method string for HTTP POST //RStringF method = iHttpSession.StringPool().StringF(HTTP::EPOST, RHTTPSession::GetTable()); RStringF method = iHttpSession.StringPool().StringF(HTTP::EGET, RHTTPSession::GetTable()); // Open transaction with previous method and parsed uri. This class will // receive transaction events in MHFRunL and MHFRunError. iTransaction = iHttpSession.OpenTransactionL(uri, *this, method); #ifndef __WINS__ CHttpFilterProxyInterface::InstallFilterL(iHttpSession); #endif // Set headers for request; user agent, accepted content type and body's // content type. RHTTPHeaders hdr = iTransaction.Request().GetHeaderCollection(); SetHeaderL(hdr, HTTP::EUserAgent, KUserAgent); SetHeaderL(hdr, HTTP::EAccept, KAccept); //SetHeaderL(hdr, HTTP::EContentType, KContentTypeForm); //iTransaction.Request().SetBody(*iHttpForm); // Submit the transaction. After this the framework will give transaction // events via MHFRunL and MHFRunError. iTransaction.SubmitL(); iRunning = ETrue; if (iHttpForm == iGetTasksForm) { iTransactionObserver->ConnectingToServerL(ETrue); } else { iTransactionObserver->ConnectingToServerL(EFalse); } } void CPMHttpEngine::MHFRunL(RHTTPTransaction aTransaction, const THTTPEvent& aEvent) { MHTTPDataSupplier* body = aTransaction.Response().Body(); switch (aEvent.iStatus) { case THTTPEvent::EGotResponseHeaders: { // HTTP response headers have been received. Use // aTransaction.Response() to get the response. However, it's not // necessary to do anything with the response when this event occurs. RHTTPResponse resp = aTransaction.Response(); TInt status = resp.StatusCode(); RStringF statusStr = resp.StatusText(); TBuf<32> statusStr16; statusStr16.Copy(statusStr.DesC()); TBuf<100> header; _LIT(KHeader,"Header=>Status ="); header.Copy(KHeader); header.Append(statusStr16); _LIT(Ksep," Body="); header.Append(Ksep); iParent->iLog.Write(header); // iUtils.Test().Printf(_L("Status: %d (%S)\n"), status, &statusStr16); *** Shrikanta *** } break; case THTTPEvent::EGotResponseBodyData: { // MHTTPDataSupplier* body = aTransaction.Response().Body(); TPtrC8 dataChunk; // TInt totsize=body->OverallDataSize(); TBool val=body->GetNextDataPart(dataChunk); body->ReleaseData(); WriteDataL(dataChunk); } break; // Indicates that header & body of response is completely received. case THTTPEvent::EResponseComplete: { // MHTTPDataSupplier* body = aTransaction.Response().Body(); TPtrC8 dataChunk; // TInt totsize=body->OverallDataSize(); ************************ERROR********* body->GetNextDataPart(dataChunk); **************************************** body->ReleaseData(); WriteDataL(dataChunk); } // break; // Indicates that transaction succeeded. case THTTPEvent::ESucceeded: { iTransaction.Close(); iRunning = EFalse; iParent->iLog.Write(iReceivedData->Des()); CResponse* response = CResponse::NewLC(iMode,iParent); TRAPD(error, response->InputDataL(*iReceivedData); iTransactionObserver->SuccessL(*response); CheckRefreshL();) PanicIfError(error); CleanupStack::PopAndDestroy(response); } break; // Transaction completed with failure. case THTTPEvent::EFailed: { iTransaction.Close(); iRunning = EFalse; // After transaction has been closed, leaves are no // longer handled by the calling active object. TRAPD(error, iTransactionObserver->FailedL(0); CheckRefreshL();) PanicIfError(error); } break; default: // There are more events in THTTPEvent, but they are not usually // needed. However, event status smaller than zero should be handled // correctly since it's error. { if (aEvent.iStatus < 0) { // Just close the transaction on errors iTransaction.Close(); iRunning = EFalse; // After transaction has been closed, leaves are no // longer handled by the calling active object. TRAPD(error, iTransactionObserver->FailedL(aEvent.iStatus); CheckRefreshL();) PanicIfError(error); } else { // Other events are not errors (e.g. permanent and temporary // redirections) } } break; } }




. to see.


