From: Michael D. <mi...@mi...> - 2007-12-11 02:40:51
|
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 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 =) 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. Take care, -Mike |