From: Dean M. B. <mik...@gm...> - 2007-12-11 08:26:11
|
Hi Mike! On Dec 11, 2007 10:40 AM, Michael Dickey <mi...@mi...> wrote: > Dean and I have been talking on the boost development list about ways > to integrate Pion code into the current cpp-netlib structure. Seemed > like a good idea to move that discussion over to this list instead. > I agree, though I'd also like to have other people in the Boost mailing list involved somehow. I like the input that we get there, and I'm thankful that the discussion has brought out interesting insights from people in the list. :) > I think that the best starting point would be to focus on merging over > Pion's HTTPParser class: > > http://pion.atomiclabs.com/files/pion-net/net/doc/html/_h_t_t_p_parser_8hpp-source.html > http://pion.atomiclabs.com/files/pion-net/net/doc/html/_h_t_t_p_parser_8cpp-source.html > > It's an incremental parser that can be used for both 1.0 and 1.1, and > also for both requests and responses. It seems like you could just > reformat & rename it for boost's style standards, remove the logging > support, and use cpp-netlib's http::request and http::response classes > in favor of Pion's HTTPRequest and HTTPResponse (so long as they > support the same functionality). > > FYI: one major thing currently missing in the parser is being able to > parse HTTP/1.1 chunks. This is supported in the "Writer" classes (see > below) but not in our underlying parsing code. Someone is working on > this right now actually, and we will probably have it in there by the > end of the week. > > To see an example of how we use it to parse a request or response > message, check out the HTTPMessage::receive() implementation: > > http://pion.atomiclabs.com/files/pion-net/net/doc/html/_h_t_t_p_message_8cpp-source.html > > Or for an asynchronous usage example, check out the HTTPReader class: > > http://pion.atomiclabs.com/files/pion-net/net/doc/html/_h_t_t_p_reader_8hpp-source.html > http://pion.atomiclabs.com/files/pion-net/net/doc/html/_h_t_t_p_reader_8cpp-source.html > > Or the HTTPRequestReader and HTTPResponseReader classes: > > http://pion.atomiclabs.com/files/pion-net/net/doc/html/_h_t_t_p_request_reader_8hpp-source.html > http://pion.atomiclabs.com/files/pion-net/net/doc/html/_h_t_t_p_response_reader_8hpp-source.html > > If you're interested in Pion's asynchronous sending code, just replace > "Reader" in any of these names with "Writer": > > http://pion.atomiclabs.com/files/pion-net/net/doc/html/_h_t_t_p_writer_8hpp-source.html > http://pion.atomiclabs.com/files/pion-net/net/doc/html/_h_t_t_p_writer_8cpp-source.html > http://pion.atomiclabs.com/files/pion-net/net/doc/html/_h_t_t_p_request_writer_8hpp-source.html > http://pion.atomiclabs.com/files/pion-net/net/doc/html/_h_t_t_p_response_writer_8hpp-source.html > > I'd really love to get more involve and work directly on converting > this code over, but honestly I'm not all that great with templates and > doing things right for a header-only approach. Your basic_message > code definitely looks cooler and more extensible but I'm having a > little trouble fully grok'ing it. Plus, I figure you would probably > do things differently than I =) > I'll go ahead and schedule this for later -- we should really be using the Sourceforge tracker for these "TODO's" . > In any case, if we could figure out how to merge this functionality > over I'd be happy to switch over to using cpp-netlib in Pion instead > of our own message-like classes. > Sweet! That sounds like good motivation for me to actually write more documentation, try porting your better parser, and see how else we can improve on decoupling the logging/networking/etc. from the actual parsing. Just a question: why shouldn't we be using Boost.Spirit for this sort of thing? -- Dean Michael C. Berris Software Engineer, Friendster, Inc. [http://cplusplus-soup.blogspot.com/] [mik...@gm...] [+63 928 7291459] [+1 408 4049523] |