On Fri, Jul 6, 2018 at 3:45 AM, David Demelier via Boost-users
It looks like HTTP response headers are saved with trailing CRLF in the message upon receiption after (async_)read.
Yes, beast::http::basic_fields stores each field/value pair in its serialized format, which includes the trailing CRLF and also the colon and space. It is done this way so that beast::http::serializer requires no memory allocations to perform its function.
Since it usually does not add additional valuable information, would it be possible to remove them in next version of Boost.Beast?
No
It will be more convenient as you don't need to trim them when you want to capture the field value.
You shouldn't have to do any trimming. basic_fields member functions and iterator value_type which return field values do so using a string_view, whose length excludes the trailing CRLF and also any colon and space. Callers should not assume the string is null-terminated, and work with the interface provided by string_view. See: https://www.boost.org/doc/libs/1_67_0/libs/beast/doc/html/beast/ref/boost__b... https://www.boost.org/doc/libs/1_67_0/libs/beast/doc/html/beast/ref/boost__b... https://www.boost.org/doc/libs/1_67_0/libs/beast/doc/html/beast/ref/boost__b... Thanks