[beast] Custom, application specific header

classic Classic list List threaded Threaded
4 messages Options
Reply | Threaded
Open this post in threaded view
|

[beast] Custom, application specific header

Boost - Users mailing list
Hi,

I need to send custom application specific header in the response, but
http::response operates only with set of predefined http::field values.

Does anyone know how can I set custom field without implementing own
`fields` class? Or is there any tips or example how can it be implemented (I
know about Fields/FieldsWriter concepts)?



--
Sent from: http://boost.2283326.n4.nabble.com/Boost-Users-f2553780.html
_______________________________________________
Boost-users mailing list
[hidden email]
https://lists.boost.org/mailman/listinfo.cgi/boost-users
Reply | Threaded
Open this post in threaded view
|

Re: [beast] Custom, application specific header

Boost - Users mailing list
On Tue, Mar 27, 2018 at 1:09 AM, DePizzottri via Boost-users
<[hidden email]> wrote:
> I need to send custom application specific header in the response, but
> http::response operates only with set of predefined http::field values.

Use the overload of basic_fields::insert which accepts a string_view
for the field name:

    boost::beast::http::request<boost::beast::http::empty_body> req;
    req.insert("X-Application-Header", "Value");

See:
<http://www.boost.org/doc/libs/1_66_0/libs/beast/doc/html/beast/ref/boost__beast__http__basic_fields/insert/overload2.html>

Thanks
_______________________________________________
Boost-users mailing list
[hidden email]
https://lists.boost.org/mailman/listinfo.cgi/boost-users
Reply | Threaded
Open this post in threaded view
|

Re: [beast] Custom, application specific header

Boost - Users mailing list
Ok, thanks, now I see. At first glance it wasn't obvious for me that the
field's name stored as reinterpreted memory buffer. Is this for name, value
and all value_type members of basic_field to lie in continuous block of
memory, or there is another reason?

Anyway, thank you for long-expected library!

I have another question: why did you disable SSE optimization in parser?



--
Sent from: http://boost.2283326.n4.nabble.com/Boost-Users-f2553780.html
_______________________________________________
Boost-users mailing list
[hidden email]
https://lists.boost.org/mailman/listinfo.cgi/boost-users
Reply | Threaded
Open this post in threaded view
|

Re: [beast] Custom, application specific header

Boost - Users mailing list
On Wed, Mar 28, 2018 at 1:44 AM, DePizzottri via Boost-users
<[hidden email]> wrote:
> Ok, thanks, now I see. At first glance it wasn't obvious for me that the
> field's name stored as reinterpreted memory buffer. Is this for name, value
> and all value_type members of basic_field to lie in continuous block of
> memory, or there is another reason?

basic_fields stores the field values in their serialized
representation, this allows the header to be serialized without
allocating any memory.
_______________________________________________
Boost-users mailing list
[hidden email]
https://lists.boost.org/mailman/listinfo.cgi/boost-users