Boost logo

Boost :

Subject: Re: [boost] [review][beast] Review of Beast starts today : July 1 - July 10
From: Vinnie Falco (vinnie.falco_at_[hidden])
Date: 2017-07-03 01:55:23


On Sun, Jul 2, 2017 at 6:43 PM, Niall Douglas via Boost
<boost_at_[hidden]> wrote:
> char buffer[16384]; // no need to explicitly limit header + body
>
> // Create a HTTP request parsing view of char[16384]
> http::request_parser<http::string_body> parser(buffer);
>
> // Read enough data to parse the request
> char *p = buffer;
> do
> {
> p += asio::read(socket, asio::buffer(p, buffer + sizeof(buffer) - p));
> } while(!parser.has_body(p - buffer));
> do_request(parser.get(), ec);
>
> // Use any spill at the end
> memcpy(buffer, buffer + parser.size_bytes(), p - (buffer +
> parser.size_bytes()));
> p = buffer;

You're asking for beast::http::parser to not use <boost/asio/buffer.hpp>

> // These prepend additional gather buffers for the headers
> res.result( http::status::ok );
> res.set( http::field::server, BEAST_VERSION_STRING );
> res.set( http::field::content_type, "image/bmp" );
> res.set( http::field::content_length, data.size() );
>
> // Tell ASIO to send the response by gathering all the buffers
> asio::write(socket, boost::make_iterator_range(res.begin(), res.end()));

This is in no way equivalent to what Beast does now, I suggest you
study BodyReader and http::serializer.

Still, it sounds like again you are simply asking that
http::serializer not use <boost/asio/buffer.hpp>

I will solicit help (not from you) to see if this problem can be
solved in a fashion that remains Asio friendly and also preserves
Beast's features (your examples don't, but you are unfamiliar with the
library so that is understandable).

Thanks


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