From: Dean M. B. <mik...@gm...> - 2007-05-21 00:19:21
|
Hi Christian! On 5/20/07, Christian Henning <chh...@gm...> wrote: > > Hi Dean, I have successfully compiled and run the code using VC7.1 . > I'm using boost 1.34. I tried boost 1.33.1 but then the test code > doesn't compile. So, I think we should make a statement of using 1.34. I actually failed to mention that I've been using Boost CVS HEAD all this time for testing. I think the problems we'll be encountering with 1.33.1 is the interface changes to Boost.Test which are not backward compatible. The version of Boost.Test in CVS is much closer to 1.34 which explains why it would build with that release. The recommendation would be that we should use Boost CVS HEAD all the time while developing and try to make the library/test build when using Boost 1.34. One reason for me to join this effort was to learn more about > networking application. So, please excuse my obvious lack of > knowledge. No problem, we're all in it for the learning as well I think. ;-) I was taking a look at asio's http example. How would you > construct your network::message to generate a client request. In this > example the client does the following: > > std::ostream request_stream(&request_); > request_stream << "GET " << path << " HTTP/1.0\r\n"; > request_stream << "Host: " << server << "\r\n"; > request_stream << "Accept: */*\r\n"; > request_stream << "Connection: close\r\n\r\n"; > > as an example the server might be "www.boost.org" and the path is > "/LICENSE_1_0.txt". The recommended usage is something in this sort: using namespace boost::network ; message request ; request << header("GET", std::string(path) + " HTTP/1.0") << header("Host", server) << header("Accept", "*/*") << header("Connection", "close") << body("") ; Which can then be encapsulated in (when we already have it) an http request object like such: using namespace boost::network; http::request boost_http_request(request, http::url(" http://boost.org/LICENSE_1_0.txt")); copy (istream_iterator<std::string>(boost_http_request), istream_iterator<std::string>(), ostream_iterator<std::string>(cout, "\n")); So what would be the source identifier, destination identifier, > header, and body? The source can be ignored, since http requests don't really need a "source", and the destination is usually just part of the message headers. Considering that the message is generic, it just holds the information which is then converted/dealt with appropriately by the 'transformer' and 'protocol implementation' -- in the above case an http::request is a network specific translator. An even simpler example (which wouldn't use a boost::network::message) would be the following: using namespace boost::network::http; request boost_website(url("http://boost.org/LICENSE_1_0.txt"), method("GET"), protocol::version<1.1>()); cout << boost_website; :-) Regards, > Christian I certainly hope the explanation above makes sense. :) If not, we can discuss this further. :) -- Dean Michael C. Berris http://cplusplus-soup.blogspot.com/ mikhailberis AT gmail DOT com +63 928 7291459 |