I don't think Antlr is of great help. There are a lot of protocol specific to process (encoding of header, URL escaping,...) that will not be done by an Antlr generated parser. I don't see the relation with the thread model and I think it's allowed to send a new request without the previous one being fully received: it is called HTTP pipelining if I remember correctly
+1 for a full HTTP review as each time I used it, I found some problems related to the full respect of the HTTP specs Regards Jeff On Sat, Feb 9, 2013 at 12:34 PM, Emmanuel Lécharny <[email protected]>wrote: > Hi guys, > > we currently have a pretty rough HTTP codec in MINA 3, based on regexp. > It's good enough for test purposes, but I wonder if it wouldn't be a > good idea to start working on somethng more robust and faster too ? > > I have gathered all the HTTP 1.1 grammar in one document, that could be > used as a base for a faster code (see the http.g file). > > I don't know if we should use antlr or write a parser by hand. I think > that using antlr would be easier, but will be at least 2 times slower > than doig it by hand. > > Another aspect is that we want this parser to be stateless, so that > means we have to keep a state in the session. > > Last, not least, we have to think about the thread model : if we > consider that a user can only send one rrequest after the other (ie, the > second request can only be processed when the previous one has been > completed), then we have no issue. We can go a bit farther, and consider > that once we have decoded a full request, then we can accept another > one, whatever the server has to do with the previsous request : the > ncoming requests are all serialized until they are decoded, then we > spawn a new thread to process the HTTP request. > > wdyt ? > > -- > Regards, > Cordialement, > Emmanuel Lécharny > www.iktek.com > > -- Jeff MAURY "Legacy code" often differs from its suggested alternative by actually working and scaling. - Bjarne Stroustrup http://www.jeffmaury.com http://riadiscuss.jeffmaury.com http://www.twitter.com/jeffmaury
