TPtrC8 CSocketEngine::GetHttpHeaderInfo(const TDesC8 &aHeaderData,const TDesC8 &aHeaderInfo){ _LIT8(KEnter,"\r\n"); TBuf8<256> bufInfo(aHeaderInfo); bufInfo.Append(_L8(": ")); TPtrC8 ret; TPtrC8 ptr; ptr.Set(aHeaderData); TInt pos=ptr.FindF(bufInfo); if(pos>0){ TInt start=pos+bufInfo.Length(); ptr.Set(ptr.Mid(start)); pos=ptr.FindF(KEnter); if(pos>0){ ptr.Set(ptr.Left(pos)); ret.Set(ptr); }else if(-1==pos){ pos=ptr.FindF(_L8("\n")); if(pos>0){ ptr.Set(ptr.Left(pos)); ret.Set(ptr); } } } return ret; }
TBool CSocketEngine::GetSHttpConnStatus(const TDesC8& aDesc){ if(aDesc.Length()>0){ TPtrC8 tmp; tmp.Set(aDesc.Left(30)); if(tmp.FindF(_L8("200"))!=KErrNotFound||tmp.FindF(_L8("206"))!=KErrNotFound||tmp.FindF(_L8("301"))!=KErrNotFound||tmp.FindF(_L8("302"))!=KErrNotFound){ return ETrue; }else{ return EFalse; } }else{ return EFalse; } }
void CContentWindowContainer::DataReceived(class MBrCtlLinkContent* aLinkContent, const isab::DataGuiMess* aMess, const char *aUrl) { HBufC8* data = NULL; HBufC* contentType = NULL; HBufC* url = WFTextUtil::AllocLC(aUrl); TPtr8 ptr(const_cast<unsigned char*>(aMess->getData()), aMess->getSize(), aMess->getSize()); TInt neck = ptr.Find(KNeck()); if (neck == KErrNotFound) { data = HBufC8::NewLC( ptr.Length()); data->Des().Copy(ptr); contentType = WFTextUtil::AllocLC("text/html"); } else { TPtrC8 header = ptr.Left(neck); TPtrC8 body = ptr.Mid(neck+4); data = HBufC8::NewLC( body.Length()); data->Des().Copy(body); TInt pos = header.Find(KLineEnd); TPtrC8 rest = header; while (pos != KErrNotFound) { TPtrC8 tmp = rest.Left(pos); rest.Set(rest.Mid(pos+2)); pos = rest.Find(KLineEnd); TInt ctpos = tmp.FindF(KContentTypeMarker); if (ctpos != KErrNotFound) { TPtrC8 tmp2 = tmp.Mid(ctpos+KContentTypeMarker().Length()); TInt scpos = tmp2.Find(KSemiColon); if (scpos == KErrNotFound) { contentType = HBufC::NewLC(tmp2.Length()); contentType->Des().Copy(tmp2); } else { contentType = HBufC::NewLC(tmp2.Left(scpos).Length()); contentType->Des().Copy(tmp2.Left(scpos)); } break; } } if (!contentType) { contentType = WFTextUtil::AllocLC("text/html"); } } /* contentType = RecognizeLC(*url, ptr); */ /* contentType = WFTextUtil::AllocLC("text/html"); */ aLinkContent->HandleResolveComplete(*contentType, KCharSet, data); CleanupStack::PopAndDestroy(contentType); CleanupStack::PopAndDestroy(data); CleanupStack::PopAndDestroy(url); }
void CListCertificates::AppendCCTCertInfoL(const TDesC8& aCCTCertInfoBuf) { TCert tempCA; tempCA.iName.FillZ(tempCA.iName.MaxLength()); TInt pos = 0; TInt err = KErrNone; // get the expected certificate label tempCA.iName.Copy(Input::ParseElement(aCCTCertInfoBuf, KCertLabelStart, KCertLabelEnd, pos, err)); // Figure out whether we expect this certificate to be readonly (ie. not deletable) // If no <ReadOnly> section is specified the default is not readonly (ie. deletable) TPtrC8 readOnly = Input::ParseElement(aCCTCertInfoBuf, KReadOnlyStart, KReadOnlyEnd, pos, err); if(err == KErrNone && readOnly.FindF(KTrue) != KErrNotFound) { tempCA.iReadOnly = ETrue; } else { tempCA.iReadOnly = EFalse; } User::LeaveIfError(iExpectedLabels.Append(tempCA)); }
// --------------------------------------------------------------------------- // CAtSmsReceive::CMTResponseFirstLineL // other items were commented in a header // --------------------------------------------------------------------------- void CAtSmsReceive::CMTResponseFirstLineL() { LOGTEXT(_L8("CAtSmsReceive::CMTResponseFirstLineL Enter funciton")); iError = KErrNone; TPtrC8 firstLineBuf; firstLineBuf.Set(Buffer()); TInt pos = firstLineBuf.FindF(KCMTResponseString); if (pos == KErrNotFound) { LOGTEXT(_L8("CAtSmsReceive::CMTResponseFirstLineL()\tError - Cannot find '+CMT:' string")); iError = KErrNotFound; return; } //skip the string of +CMT: pos += KCMTResponseString().Length(); //skip a "," character while(!(TChar(firstLineBuf[pos]).IsDigit())) { ++pos; } TInt lenPos = firstLineBuf.Length()-pos; TPtrC8 pduLenBuf; pduLenBuf.Set(firstLineBuf.Right(lenPos)); TLex8 lex(pduLenBuf); TUint16 val; TInt ret = lex.Val(val,EDecimal); if(ret != KErrNone) { iError = ret; return; } iPduLen = val; LOGTEXT2(_L8("New SMS detected of length %d"),iPduLen); }