Parsing http header con la classe TLex

esempio di uso di TLex:
TLex8 lbuf=TLex8(aBuf);

check:
if (crF)
{
  if (lbuf.Peek()==Klf)
  {
    TUint hdridx=iHeadEnd + 1 + lbuf.Offset();
    if (iLastHdrIdx +1 == hdridx)
      iHdrClosed = ETrue;
    iLastHdrIdx = hdridx;
    iIdxs->Append(iLastHdrIdx);
    iHdrNr++;
  }
  lbuf.Inc();
  crF=EFalse;
}
while (lbuf.Offset() lbuf.Inc();

if (lbuf.Peek()==Kcr) crF=ETrue;
if (lbuf.Offset()==aSize)
  goto parsed;
goto check;
parsed:

Prende un intero http response buffer e parsa le linee di header http. iLastIdrIdx è trovato cercando la sequenza \r\n\r\n in aBuf. Questo codice parsa l'header e mette in iIdxs array gli indici degli header. LIT8(Kcr,"\r"); LIT8(Klf,"\n");

Reply

The content of this field is kept private and will not be shown publicly.
  • Web page addresses and e-mail addresses turn into links automatically.
  • Allowed HTML tags: <a> <em> <strong> <cite> <code> <ul> <ol> <li> <dl> <dt> <dd>
  • Lines and paragraphs break automatically.

More information about formatting options

Captcha
This question is used to make sure you are a human visitor and to prevent spam submissions.
Copy the characters (respecting upper/lower case) from the image.