Parsing http header with TLex class

example of TLex use:
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:

Take a whole http response and parse header lines. iLastIdrIdx is found searching \r\n\r\n sequence in aBuf. This code parse header and put in iIdxs int array. LIT8(Kcr,"\r"); LIT8(Klf,"\n");

Comments

re

Hi there, your article has proven very useful
thank you.

Comment viewing options

Select your preferred way to display the comments and click "Save settings" to activate your changes.