diff --git a/CHANGELOG.md b/CHANGELOG.md index a1ba5cff..8d8f9325 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -1,6 +1,7 @@ Version 260: * More split compilation in rfc7230.hpp +* Qualify calls to `beast::iequals` in basic_parser.ipp -------------------------------------------------------------------------------- diff --git a/include/boost/beast/core/detail/string.hpp b/include/boost/beast/core/detail/string.hpp index a1b11b8b..b553c604 100644 --- a/include/boost/beast/core/detail/string.hpp +++ b/include/boost/beast/core/detail/string.hpp @@ -17,6 +17,10 @@ namespace beast { namespace detail { +// Pulling in the UDL directly breaks in some places on MSVC, +// so introduce a namespace for this purprose. +namespace string_literals { + inline string_view operator"" _sv(char const* p, std::size_t n) @@ -24,6 +28,8 @@ operator"" _sv(char const* p, std::size_t n) return string_view{p, n}; } +} // string_literals + inline char ascii_tolower(char c) diff --git a/include/boost/beast/http/impl/basic_parser.ipp b/include/boost/beast/http/impl/basic_parser.ipp index a3b0ad6f..5cab22a8 100644 --- a/include/boost/beast/http/impl/basic_parser.ipp +++ b/include/boost/beast/http/impl/basic_parser.ipp @@ -16,6 +16,7 @@ #include #include #include +#include #include #include #include @@ -746,6 +747,7 @@ basic_parser:: do_field(field f, string_view value, error_code& ec) { + using namespace beast::detail::string_literals; // Connection if(f == field::connection || f == field::proxy_connection) @@ -759,19 +761,19 @@ do_field(field f, } for(auto const& s : list) { - if(iequals({"close", 5}, s)) + if(beast::iequals("close"_sv, s)) { f_ |= flagConnectionClose; continue; } - if(iequals({"keep-alive", 10}, s)) + if(beast::iequals("keep-alive"_sv, s)) { f_ |= flagConnectionKeepAlive; continue; } - if(iequals({"upgrade", 7}, s)) + if(beast::iequals("upgrade"_sv, s)) { f_ |= flagConnectionUpgrade; continue; @@ -832,9 +834,9 @@ do_field(field f, ec = {}; auto const v = token_list{value}; auto const p = std::find_if(v.begin(), v.end(), - [&](typename token_list::value_type const& s) + [&](string_view const& s) { - return iequals({"chunked", 7}, s); + return beast::iequals("chunked"_sv, s); }); if(p == v.end()) return; diff --git a/include/boost/beast/http/impl/fields.hpp b/include/boost/beast/http/impl/fields.hpp index 3cc4a4cb..0fa3bedd 100644 --- a/include/boost/beast/http/impl/fields.hpp +++ b/include/boost/beast/http/impl/fields.hpp @@ -577,7 +577,7 @@ insert(field name, } auto const last = std::prev(before); // VFALCO is it worth comparing `field name` first? - if(! iequals(sname, last->name_string())) + if(! beast::iequals(sname, last->name_string())) { BOOST_ASSERT(count(sname) == 0); set_.insert_before(before, e); @@ -818,7 +818,7 @@ get_chunked_impl() const { auto const next = std::next(it); if(next == te.end()) - return iequals(*it, "chunked"); + return beast::iequals(*it, "chunked"); it = next; } return false; @@ -901,7 +901,7 @@ set_chunked_impl(bool value) auto const next = std::next(itt); if(next == te.end()) { - if(iequals(*itt, "chunked")) + if(beast::iequals(*itt, "chunked")) return; // already set break; } @@ -1001,7 +1001,7 @@ set_element(element& e) { auto it = set_.lower_bound( e.name_string(), key_compare{}); - if(it == set_.end() || ! iequals( + if(it == set_.end() || ! beast::iequals( e.name_string(), it->name_string())) { set_.insert_before(it, e); @@ -1017,7 +1017,7 @@ set_element(element& e) delete_element(*it); it = next; if(it == set_.end() || - ! iequals(e.name_string(), it->name_string())) + ! beast::iequals(e.name_string(), it->name_string())) break; } set_.insert_before(it, e); diff --git a/include/boost/beast/http/impl/verb.ipp b/include/boost/beast/http/impl/verb.ipp index 7e8dd882..988f1b94 100644 --- a/include/boost/beast/http/impl/verb.ipp +++ b/include/boost/beast/http/impl/verb.ipp @@ -21,7 +21,7 @@ namespace http { string_view to_string(verb v) { - using beast::detail::operator "" _sv; + using namespace beast::detail::string_literals; switch(v) { case verb::delete_: return "DELETE"_sv; @@ -109,7 +109,7 @@ string_to_verb(string_view v) UNLOCK UNSUBSCRIBE */ - using beast::detail::operator "" _sv; + using namespace beast::detail::string_literals; if(v.size() < 3) return verb::unknown; auto c = v[0]; diff --git a/include/boost/beast/websocket/detail/hybi13.ipp b/include/boost/beast/websocket/detail/hybi13.ipp index 95d1086d..0d9f7588 100644 --- a/include/boost/beast/websocket/detail/hybi13.ipp +++ b/include/boost/beast/websocket/detail/hybi13.ipp @@ -47,7 +47,7 @@ make_sec_ws_accept( string_view key) { BOOST_ASSERT(key.size() <= sec_ws_key_type::max_size_n); - using beast::detail::operator "" _sv; + using namespace beast::detail::string_literals; auto const guid = "258EAFA5-E914-47DA-95CA-C5AB0DC85B11"_sv; beast::detail::sha1_context ctx; beast::detail::init(ctx); diff --git a/include/boost/beast/websocket/detail/pmd_extension.ipp b/include/boost/beast/websocket/detail/pmd_extension.ipp index 790998e8..005feec1 100644 --- a/include/boost/beast/websocket/detail/pmd_extension.ipp +++ b/include/boost/beast/websocket/detail/pmd_extension.ipp @@ -52,11 +52,11 @@ pmd_read_impl(pmd_offer& offer, http::ext_list const& list) for(auto const& ext : list) { - if(iequals(ext.first, "permessage-deflate")) + if(beast::iequals(ext.first, "permessage-deflate")) { for(auto const& param : ext.second) { - if(iequals(param.first, + if(beast::iequals(param.first, "server_max_window_bits")) { if(offer.server_max_window_bits != 0) @@ -84,7 +84,7 @@ pmd_read_impl(pmd_offer& offer, http::ext_list const& list) return; // MUST decline } } - else if(iequals(param.first, + else if(beast::iequals(param.first, "client_max_window_bits")) { if(offer.client_max_window_bits != 0) @@ -112,7 +112,7 @@ pmd_read_impl(pmd_offer& offer, http::ext_list const& list) offer.client_max_window_bits = -1; } } - else if(iequals(param.first, + else if(beast::iequals(param.first, "server_no_context_takeover")) { if(offer.server_no_context_takeover) @@ -131,7 +131,7 @@ pmd_read_impl(pmd_offer& offer, http::ext_list const& list) } offer.server_no_context_takeover = true; } - else if(iequals(param.first, + else if(beast::iequals(param.first, "client_no_context_takeover")) { if(offer.client_no_context_takeover)