From dcf3db7f83ad8c9037bb9dd9208b5382eb2a2510 Mon Sep 17 00:00:00 2001 From: Damian Jarek Date: Sun, 19 May 2019 17:37:08 +0200 Subject: [PATCH] Remove redundant use of `static_string` This avoids an instantiation and copy of the data when adding the Server header field. Close #1613 Signed-off-by: Damian Jarek --- CHANGELOG.md | 1 + include/boost/beast/websocket/impl/accept.hpp | 9 ++------- 2 files changed, 3 insertions(+), 7 deletions(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index 0bda1eef..cc387fb8 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -2,6 +2,7 @@ Version 256: * Remove uses of the deprecated `buffers` function * Remove uses of deprecated methods in websocket tests +* Remove redundant use of `static_string` -------------------------------------------------------------------------------- diff --git a/include/boost/beast/websocket/impl/accept.hpp b/include/boost/beast/websocket/impl/accept.hpp index 4b989b56..46c2e0c2 100644 --- a/include/boost/beast/websocket/impl/accept.hpp +++ b/include/boost/beast/websocket/impl/accept.hpp @@ -80,13 +80,8 @@ build_response( decorator_opt(res); decorator(res); if(! res.count(http::field::server)) - { - // VFALCO this is weird.. - BOOST_STATIC_ASSERT(sizeof( - BOOST_BEAST_VERSION_STRING) < 20); - static_string<20> s(BOOST_BEAST_VERSION_STRING); - res.set(http::field::server, s); - } + res.set(http::field::server, + string_view(BOOST_BEAST_VERSION_STRING)); }; auto err = [&](error e)