From: Jeroen H. <vex...@gm...> - 2010-09-09 21:30:54
|
On 9 September 2010 19:56, Dean Michael Berris <mik...@gm...> wrote: > Hi Guys, > > Just a quick heads up, I've pushed an incremental parser for HTTP > responses that I'm building with two birds to hit: > > 1. Develop a spec-compliant HTTP response message parser that is > stateful, space-efficient, and is restartable that will be used in the > asynchronous http client implementation. > > 2. Develop an incremental parser concept which might stand as a good > abstraction on its own. > > #1 is the short term goal, while #2 is the longer term goal. The > reason for #2 is similar to the reasoning behind the development of > the Message concept as well as the Request and Response concepts: so > that it would be easier for us and others to implement compliant, > drop-in implementations that model the Message, Request, and Response > concepts. The goal for having a suitable incremental parser interface > is so that we can generally abstract the client/server implementations > enough to just rely on concepts like an IncrementalParser which can be > implemented underneath using as many different technologies as > possible. > > I think if we have an implementation of incremental parsers for HTTP, > XMPP, SMTP, then that might make a compelling component of the library > that would be useful in different kinds of applications -- much like > how the URI parser is really useful in many different contexts outside > of just cpp-netlib. > > Thanks guys and I hope this helps. > > PS. In case you want to pick up where I've left things hanging, please > feel free to fork and send in pull requests. I've tried to document > the rationale in the test, and will be documenting the rationale for > the implementation more as I we go along. The test is in > libs/network/test/http_incremental_parser.cpp (in commit > http://bit.ly/dmkA9f, the actual file is http://bit.ly/9h61ju). The > implementation now is able to at least parse the HTTP version part of > a range, and say whether it was successful or whether there are still > missing parts, or that the range isn't conforming. > > -- > Dean Michael Berris > deanberris.com > Hi Dean, Brilliant! I've personally always considered this to be a weak spot in cpp-netlib and given how important it is, I'm glad it's getting some attention. Having said that, I'm surprised you're starting from scratch given that there are some very good and tested HTTP parsers out there (mongrel comes to mind). Secondly I must ask you to read, and re-read the RFC and to make sure you follow it (I've had a quick glance at the code you've committed and already spotted a deviation, for which I've filed an issue at github). Currently I've got little time to spend on cpp-netlib since I'm busy with a project of my own (shameless plug, http://github.com/VeXocide/construe_cast) but I'll definitely be following this closely. Regards, Jeroen Habraken |