From: Dean M. B. <mik...@gm...> - 2007-12-11 08:22:46
|
Hi Alex, On Dec 11, 2007 4:14 PM, Alex Ott <al...@gm...> wrote: > > i had looked into protocol/http/impl/request.hpp and had seen, that it > include URI parser. i think, that it better to implement URI parser in > their own namespace, as it could be used not only in http parsing, but > also in other places. Yup, I agree. I intend to refactor those out later -- but that would mean there would be tons of tests just to make sure that the parser is correct. That sounds like a lot of work, but if you'd like to try that out, please be my guest. :) > Also, may be it will be useful during implementation - may be not hard > code "HTTP" protocol name in parser, but specify it as template > parameter? I suggest this, as some other protocols (such as ICAP), use > the same structure as HTTP, but different protocol name > This makes sense. Please add a task in the tracker -- Glyn, do you have an idea how to best use the Sourceforge Trackers? > P.S. i has almost working http request/response parsers, but i has > some problems with mixing boost::spirit + std::multimap. > I use following structures to hold information about request/response > (and corresponding parsers): > > struct Version { > std::string protocol; > unsigned int major; > unsigned int minor; > }; > > struct Common { > Version version; > typedef std::multimap<std::string,std::string> headers_t; > headers_t headers; > std::string body; // may be will replaced with vector<char> > } ; > struct Request : public Common { > URI url; > std::string command; > } ; > struct Response : public Common { > std::string textStatus; > uint16_t intStatus; > } ; > I'm not sure what you're trying to accomplish though, so it's hard to comment. I've found out that with Boost.Spirit, it's usually best that you use semantic actions built with Phoenix. I'm not sure if there have been major changes with Phoenix the past few months, and having seen Boost.Spirit being release-ready in Boost Trunk, it would be a good idea to use those instead. Having said that, we should be updating the sources that require Fusion -- there have been breaking changes with the directory structure since we last tested the code, but unfortunately I don't have time yet to get to those. -- Dean Michael C. Berris Software Engineer, Friendster, Inc. [http://cplusplus-soup.blogspot.com/] [mik...@gm...] [+63 928 7291459] [+1 408 4049523] |