Nick Sabalausky Wrote:

> "Sean Kelly" <[email protected]> wrote in message 
> >
> > Read the HTTP RFC, tear your hair out as you realize that the grammar 
> > isn't context-free
> 
> Really? It seems so simple (but of course, XML seems really simple at first 
> glance, too). Have an example?

I may have exaggerated a tad, but the issue I was thinking of is that the 
header values can contain pretty much anything--particularly cookies (no one 
follows the cookie RFC).  So it's not uncommon to see:

    Cookie: myval=thing1:thing2

And then of course the body is just a blob of whatever.  So you can't just 
tokenize an HTTP request the same way you would a D module, for example.  You 
have to know whether you're in the control line (GET /thingy HTTP/1.1), header 
key, header value, or body part.  What I've found so far is that it's easiest 
to simply break a request into control line, set of header key/value pairs (of 
which there can be duplicates of the same key), and body blob and then parse 
individual headers or the body separately as needed.  This is more efficient 
anyway I suppose.  It's just irksome that it seems necessary.

Reply via email to