[beast] Custom, application specific header
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
On Tue, Mar 27, 2018 at 1:09 AM, DePizzottri via Boost-users
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::requestboost::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__be... Thanks
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
On Wed, Mar 28, 2018 at 1:44 AM, DePizzottri via Boost-users
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.
participants (2)
-
DePizzottri
-
Vinnie Falco