Boost logo

Boost :

From: Dean Michael Berris (mikhailberis_at_[hidden])
Date: 2007-05-17 13:30:25


On 5/17/07, Mathias Gaunard <mathias.gaunard_at_[hidden]> wrote:
> Dean Michael Berris wrote:
> >
> > std::cout << http::message(m)
> > (url("http://www.boost.org"))
> > (method(http::post))
> > << std::endl;
> > std::cout << smtp::message(m)
> > (to("boost_at_[hidden]")) << std::endl;
>
>
> Does that mean the message won't be able to be read incrementally?
>

In the above example, the overload to operator<< will turn the message
into a string for output. It can definitely be made such that an
adapter to make a http_message instance an InputStreamIterator will
return chunks, but in essence a message is basically an object that
keeps information.

Making 'message' act like a multi-container would also help, something like:

  using namespace boost::network;
  message m; m << header("SOME_HEADER", 100) << header("OTHER_HEADER", 101);
  std::copy (begin<std::string>(headers(m)), end<std::string>(headers(m)),
    ostream_iterator<std::string>(std::cout, "\n"));

The message type (and instances) will contain information that will
later be used by routines relating to HTTP. For example:

  using namespace boost::network;
  message m; m << header("HOST", "www.boost.org");
  http_request request(http_message(m).url("http://www.boost.org/"));
  copy (istream_iterator<std::string>(request), istream_iterator<std::string>(),
    ostream_iterator<std::string>(std::cout, "\n"));

Should be doable, but is dependent on how 'http_request' is implemented.

So there are two parts here: the message type being "convertible" to a
string and it being "chunk-able", and the other part being the result
of network operations given a message instance as the "driver" or
"source" which forms the actual request.

Things should be clearer when I come out with a design document. ;-)

-- 
Dean Michael C. Berris
http://cplusplus-soup.blogspot.com/
mikhailberis AT gmail DOT com
+63 928 7291459

Boost list run by bdawes at acm.org, gregod at cs.rpi.edu, cpdaniel at pacbell.net, john at johnmaddock.co.uk