Boost logo

Boost :

Subject: Re: [boost] [beast] Automatic content-length?
From: Vinnie Falco (vinnie.falco_at_[hidden])
Date: 2017-07-02 14:59:36


On Sun, Jul 2, 2017 at 7:51 AM, Peter Dimov via Boost
<boost_at_[hidden]> wrote:
> If "here" is Beast, then perhaps there should be a way to either fix or
> detect the mistake of forgetting to set the Content-Length.

 I don't see how that's possible. We can't fix it, as the message is
const& in the serializer (and making it non const means that sending
the same message cannot happen concurrently).

There's no way to detect the mistake in `serializer`, as the Fields
concept provides no mechanism for inspecting the value of fields:
http://vinniefalco.github.io/stage/beast/review/beast/concept/Fields.html

We could add a way to extract Content-Length to the requirements of
FieldsReader:
http://vinniefalco.github.io/stage/beast/review/beast/concept/FieldsReader.html

This increases the burden of modeling FieldsReader. I'm reluctant to
it because the only use would be to call BOOST_ASSERT for this case.
Although seeing that both me and Chris made the same mistake, I might
be convinced otherwise.


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