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(""))
> > (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", "");
  http_request request(http_message(m).url(""));
  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
mikhailberis AT gmail DOT com
+63 928 7291459

Boost list run by bdawes at, gregod at, cpdaniel at, john at