diff --git a/CHANGELOG.md b/CHANGELOG.md index e3def1c6..43818148 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -1,5 +1,7 @@ 1.0.0-b39 +* Use beast::string_view alias + WebSocket: * Add websocket async echo ssl server test: diff --git a/doc/quickref.xml b/doc/quickref.xml index 7c126f81..0463d753 100644 --- a/doc/quickref.xml +++ b/doc/quickref.xml @@ -168,6 +168,7 @@ static_buffer static_buffer_n static_string + string_view system_error diff --git a/include/beast/core/detail/ci_char_traits.hpp b/include/beast/core/detail/ci_char_traits.hpp index 07fecc81..da8bc3cd 100644 --- a/include/beast/core/detail/ci_char_traits.hpp +++ b/include/beast/core/detail/ci_char_traits.hpp @@ -8,8 +8,8 @@ #ifndef BEAST_DETAIL_CI_CHAR_TRAITS_HPP #define BEAST_DETAIL_CI_CHAR_TRAITS_HPP +#include #include -#include namespace beast { namespace detail { @@ -42,10 +42,10 @@ tolower(signed char c) template inline -boost::string_ref +string_view string_helper(const char (&s)[N]) { - return boost::string_ref{s, N-1}; + return string_view{s, N-1}; } template diff --git a/include/beast/core/detail/static_string.hpp b/include/beast/core/detail/static_string.hpp index fe3ee177..dbd92df1 100644 --- a/include/beast/core/detail/static_string.hpp +++ b/include/beast/core/detail/static_string.hpp @@ -8,7 +8,7 @@ #ifndef BEAST_DETAIL_STATIC_STRING_HPP #define BEAST_DETAIL_STATIC_STRING_HPP -#include +#include #include #include diff --git a/include/beast/core/impl/static_string.ipp b/include/beast/core/impl/static_string.ipp index 14aa968a..4eec94fd 100644 --- a/include/beast/core/impl/static_string.ipp +++ b/include/beast/core/impl/static_string.ipp @@ -95,7 +95,7 @@ static_string(std::initializer_list init) template static_string:: -static_string(boost::basic_string_ref sv) +static_string(string_view_type sv) { assign(sv); } @@ -188,12 +188,10 @@ template auto static_string:: assign(T const& t, size_type pos, size_type count) -> - typename std::enable_if< - std::is_convertible>::value, static_string&>::type + typename std::enable_if::value, static_string&>::type { - auto const sv = boost::basic_string_ref< - CharT, Traits>(t).substr(pos, count); + auto const sv = string_view_type(t).substr(pos, count); if(sv.size() > max_size()) throw detail::make_exception( "sv.size() > max_size()", __FILE__, __LINE__); @@ -352,14 +350,13 @@ auto static_string:: insert(size_type index, const T& t, size_type index_str, size_type count) -> - typename std::enable_if< - std::is_convertible>::value && + typename std::enable_if::value && ! std::is_convertible::value, static_string&>::type { - auto const str = boost::basic_string_ref< - CharT, Traits>(t).substr(index_str, count); + auto const str = + string_view_type(t).substr(index_str, count); return insert(index, str.data(), str.size()); } @@ -424,16 +421,17 @@ append(static_string const& str, if(pos >= str.size()) throw detail::make_exception( "pos > str.size()", __FILE__, __LINE__); - boost::basic_string_ref const ss{ - &str.s_[pos], (std::min)(count, str.size() - pos)}; + string_view_type const ss{&str.s_[pos], + (std::min)(count, str.size() - pos)}; insert(size(), ss.data(), ss.size()); return *this; } template -boost::basic_string_ref +auto static_string:: -substr(size_type pos, size_type count) const +substr(size_type pos, size_type count) const -> + string_view_type { if(pos > size()) throw detail::make_exception( diff --git a/include/beast/core/static_string.hpp b/include/beast/core/static_string.hpp index 73d051af..1bd359e5 100644 --- a/include/beast/core/static_string.hpp +++ b/include/beast/core/static_string.hpp @@ -9,8 +9,8 @@ #define BEAST_STATIC_STRING_HPP #include +#include #include -#include #include #include #include @@ -70,6 +70,10 @@ public: using const_reverse_iterator = std::reverse_iterator; + /// The type of `string_view` returned by the interface + using string_view_type = + beast::basic_string_view; + // // Constants // @@ -123,23 +127,21 @@ public: /// Construct from an initializer list static_string(std::initializer_list init); - /// Construct from a `basic_string_ref` + /// Construct from a `string_view` explicit - static_string(boost::basic_string_ref sv); + static_string(string_view_type sv); - /** Construct from any object convertible to `basic_string_ref`. + /** Construct from any object convertible to `string_view_type`. The range (pos, n) is extracted from the value - obtained by converting `t` to `basic_string_ref`, + obtained by converting `t` to `string_view_type`, and used to construct the string. */ #if BEAST_DOXYGEN template #else - template> ::value>::type> + template::value>::type> #endif static_string(T const& t, size_type pos, size_type n); @@ -184,9 +186,9 @@ public: return assign(init); } - /// Assign from `basic_string_ref`. + /// Assign from `string_view_type`. static_string& - operator=(boost::basic_string_ref sv) + operator=(string_view_type sv) { return assign(sv); } @@ -240,26 +242,25 @@ public: return assign(init.begin(), init.end()); } - /// Assign from `basic_string_ref`. + /// Assign from `string_view_type`. static_string& - assign(boost::basic_string_ref str) + assign(string_view_type str) { return assign(str.data(), str.size()); } - /** Assign from any object convertible to `basic_string_ref`. + /** Assign from any object convertible to `string_view_type`. The range (pos, n) is extracted from the value - obtained by converting `t` to `basic_string_ref`, + obtained by converting `t` to `string_view_type`, and used to assign the string. */ template #if BEAST_DOXYGEN static_string& #else - typename std::enable_if< - std::is_convertible>::value, static_string&>::type + typename std::enable_if::value, static_string&>::type #endif assign(T const& t, size_type pos, size_type count = npos); @@ -339,10 +340,8 @@ public: return data(); } - // VFALCO What about boost::string_view? - // - /// Convert a static string to a `static_string_ref` - operator boost::basic_string_ref() const + /// Convert a static string to a `string_view_type` + operator string_view_type() const { return boost::basic_string_ref< CharT, Traits>{data(), size()}; @@ -552,8 +551,7 @@ public: } static_string& - insert(size_type index, - boost::basic_string_ref str) + insert(size_type index, string_view_type str) { return insert(index, str.data(), str.size()); } @@ -563,8 +561,7 @@ public: static_string& #else typename std::enable_if< - std::is_convertible>::value && + std::is_convertible::value && ! std::is_convertible::value, static_string&>::type #endif @@ -645,7 +642,7 @@ public: } static_string& - append(boost::basic_string_ref sv) + append(string_view_type sv) { insert(size(), sv); return *this; @@ -653,8 +650,7 @@ public: template typename std::enable_if< - std::is_convertible>::value && + std::is_convertible::value && ! std::is_convertible::value, static_string&>::type append(T const& t, size_type pos, size_type count = npos) @@ -690,7 +686,7 @@ public: } static_string& - operator+=(boost::basic_string_ref const& str) + operator+=(string_view_type const& str) { return append(str); } @@ -746,7 +742,7 @@ public: } int - compare(boost::basic_string_ref str) const + compare(string_view_type str) const { return detail::lexicographical_compare( &s_[0], n_, str.data(), str.size()); @@ -754,7 +750,7 @@ public: int compare(size_type pos1, size_type count1, - boost::basic_string_ref str) const + string_view_type str) const { return detail::lexicographical_compare( substr(pos1, count1), str); @@ -765,8 +761,7 @@ public: int #else typename std::enable_if< - std::is_convertible>::value && + std::is_convertible::value && ! std::is_convertible::value, int>::type #endif @@ -775,11 +770,10 @@ public: size_type count2 = npos) const { return compare(pos1, count1, - boost::basic_string_ref< - CharT, Traits>(t).substr(pos2, count2)); + string_view_type(t).substr(pos2, count2)); } - boost::basic_string_ref + string_view_type substr(size_type pos = 0, size_type count = npos) const; /// Copy a substring (pos, pos+count) to character string pointed to by `dest`. @@ -1101,7 +1095,7 @@ operator<<(std::basic_ostream& os, static_string const& str) { return os << static_cast< - boost::basic_string_ref>(str); + beast::basic_string_view>(str); } } // beast diff --git a/include/beast/core/string_view.hpp b/include/beast/core/string_view.hpp new file mode 100644 index 00000000..fbe905e4 --- /dev/null +++ b/include/beast/core/string_view.hpp @@ -0,0 +1,25 @@ +// +// Copyright (c) 2013-2017 Vinnie Falco (vinnie dot falco at gmail dot com) +// +// Distributed under the Boost Software License, Version 1.0. (See accompanying +// file LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt) +// + +#ifndef BEAST_STRING_VIEW_HPP +#define BEAST_STRING_VIEW_HPP + +#include + +namespace beast { + +/// The type of string_view used by the library +using string_view = boost::string_ref; + +/// The type of basic_string_view used by the library +template +using basic_string_view = + boost::basic_string_ref; + +} // beast + +#endif diff --git a/include/beast/http/basic_parser.hpp b/include/beast/http/basic_parser.hpp index 4df1663b..d2ea5677 100644 --- a/include/beast/http/basic_parser.hpp +++ b/include/beast/http/basic_parser.hpp @@ -10,11 +10,11 @@ #include #include +#include #include #include #include #include -#include #include #include @@ -93,8 +93,8 @@ enum class parse_state // void on_request( - boost::string_ref const& method, - boost::string_ref const& target, + string_view const& method, + string_view const& target, int version, error_code& ec); @@ -104,7 +104,7 @@ enum class parse_state void on_response( int status, - boost::string_ref const& reason, + string_view const& reason, int version, error_code& ec); @@ -112,8 +112,8 @@ enum class parse_state // void on_field( - boost::string_ref const& name, - boost::string_ref const& value, + string_view const& name, + string_view const& value, error_code& ec); // Called after the header is complete. @@ -136,7 +136,7 @@ enum class parse_state // void on_data( - boost::string_ref const& s, + string_view const& s, error_code& ec); // Called zero or more times to retrieve a mutable @@ -165,7 +165,7 @@ enum class parse_state void on_chunk( std::uint64_t length, // Length of this chunk - boost::string_ref const& ext, // The chunk extensions, if any + string_view const& ext, // The chunk extensions, if any error_code& ec); // Called once when the message is complete. @@ -250,8 +250,8 @@ class basic_parser std::size_t x_; // scratch variable unsigned f_ = 0; // flags parse_state state_ = parse_state::header; - boost::string_ref ext_; - boost::string_ref body_; + string_view ext_; + string_view body_; public: /// Copy constructor (disallowed) @@ -454,7 +454,7 @@ public: buffer's `consume` function may invalidate this return value. */ - boost::string_ref const& + string_view const& body() const { // This function not available when isDirect==true @@ -472,7 +472,7 @@ public: buffer's `consume` function may invalidate this return value. */ - boost::string_ref const& + string_view const& chunk_extension() const { // This function not available when isDirect==true @@ -567,7 +567,7 @@ private: } template - boost::string_ref + string_view maybe_flatten( ConstBufferSequence const& buffers); @@ -595,8 +595,8 @@ private: void do_field( - boost::string_ref const& name, - boost::string_ref const& value, + string_view const& name, + string_view const& value, error_code& ec); std::size_t diff --git a/include/beast/http/detail/basic_parsed_list.hpp b/include/beast/http/detail/basic_parsed_list.hpp index 596cd558..5f75790b 100644 --- a/include/beast/http/detail/basic_parsed_list.hpp +++ b/include/beast/http/detail/basic_parsed_list.hpp @@ -8,8 +8,8 @@ #ifndef BEAST_HTTP_DETAIL_BASIC_PARSED_LIST_HPP #define BEAST_HTTP_DETAIL_BASIC_PARSED_LIST_HPP +#include #include -#include #include #include @@ -22,7 +22,7 @@ namespace detail { template class basic_parsed_list { - boost::string_ref s_; + string_view s_; public: /// The type of policy this list uses for parsing. @@ -128,7 +128,7 @@ public: /// Construct a list from a string explicit - basic_parsed_list(boost::string_ref const& s) + basic_parsed_list(string_view const& s) : s_(s) { } diff --git a/include/beast/http/detail/basic_parser.hpp b/include/beast/http/detail/basic_parser.hpp index 254694de..5a78d02c 100644 --- a/include/beast/http/detail/basic_parser.hpp +++ b/include/beast/http/detail/basic_parser.hpp @@ -8,10 +8,10 @@ #ifndef BEAST_HTTP_DETAIL_BASIC_PARSER_HPP #define BEAST_HTTP_DETAIL_BASIC_PARSER_HPP +#include #include #include #include -#include #include #include #include @@ -187,7 +187,7 @@ protected: } static - boost::string_ref + string_view make_string(char const* first, char const* last) { return {first, static_cast< @@ -197,8 +197,8 @@ protected: template static bool - strieq(boost::string_ref const& s1, - boost::string_ref const& s2) + strieq(string_view const& s1, + string_view const& s2) { if(s1.size() != s2.size()) return false; @@ -213,7 +213,7 @@ protected: template bool strieq(const char (&s1)[N], - boost::string_ref const& s2) + string_view const& s2) { return strieq({s1, N-1}, s2); } @@ -272,19 +272,19 @@ protected: } static - boost::string_ref + string_view parse_method(char const*& it) { auto const first = it; while(detail::is_tchar(*it)) ++it; return {first, static_cast< - boost::string_ref::size_type>( + string_view::size_type>( it - first)}; } static - boost::string_ref + string_view parse_target(char const*& it) { auto const first = it; @@ -293,19 +293,19 @@ protected: if(*it != ' ') return {}; return {first, static_cast< - boost::string_ref::size_type>( + string_view::size_type>( it - first)}; } static - boost::string_ref + string_view parse_name(char const*& it) { auto const first = it; while(to_field_char(*it)) ++it; return {first, static_cast< - boost::string_ref::size_type>( + string_view::size_type>( it - first)}; } @@ -352,7 +352,7 @@ protected: } static - boost::string_ref + string_view parse_reason(char const*& it) { auto const first = it; diff --git a/include/beast/http/detail/fields.hpp b/include/beast/http/detail/fields.hpp index 60af3872..906f3cc3 100644 --- a/include/beast/http/detail/fields.hpp +++ b/include/beast/http/detail/fields.hpp @@ -8,10 +8,10 @@ #ifndef BEAST_HTTP_DETAIL_FIELDS_HPP #define BEAST_HTTP_DETAIL_FIELDS_HPP +#include #include #include #include -#include namespace beast { namespace http { @@ -29,20 +29,20 @@ public: std::string first; std::string second; - value_type(boost::string_ref const& name_, - boost::string_ref const& value_) + value_type(string_view const& name_, + string_view const& value_) : first(name_) , second(value_) { } - boost::string_ref + string_view name() const { return first; } - boost::string_ref + string_view value() const { return second; @@ -63,8 +63,8 @@ protected: { value_type data; - element(boost::string_ref const& name, - boost::string_ref const& value) + element(string_view const& name, + string_view const& value) : data(name, value) { } diff --git a/include/beast/http/detail/rfc7230.hpp b/include/beast/http/detail/rfc7230.hpp index f5fba0a1..e60655e7 100644 --- a/include/beast/http/detail/rfc7230.hpp +++ b/include/beast/http/detail/rfc7230.hpp @@ -8,7 +8,7 @@ #ifndef BEAST_HTTP_DETAIL_RFC7230_HPP #define BEAST_HTTP_DETAIL_RFC7230_HPP -#include +#include #include #include @@ -328,8 +328,8 @@ skip_token(FwdIt& it, FwdIt const& last) } inline -boost::string_ref -trim(boost::string_ref const& s) +string_view +trim(string_view const& s) { auto first = s.begin(); auto last = s.end(); @@ -349,12 +349,12 @@ trim(boost::string_ref const& s) struct param_iter { - using iter_type = boost::string_ref::const_iterator; + using iter_type = string_view::const_iterator; iter_type it; iter_type first; iter_type last; - std::pair v; + std::pair v; bool empty() const @@ -455,11 +455,11 @@ increment() */ struct opt_token_list_policy { - using value_type = boost::string_ref; + using value_type = string_view; bool operator()(value_type& v, - char const*& it, boost::string_ref const& s) const + char const*& it, string_view const& s) const { v = {}; auto need_comma = it != s.begin(); @@ -485,7 +485,7 @@ struct opt_token_list_policy if(! detail::is_tchar(*it)) break; } - v = boost::string_ref{&*p0, + v = string_view{&*p0, static_cast(it - p0)}; return true; } diff --git a/include/beast/http/fields.hpp b/include/beast/http/fields.hpp index 4fc0a2d5..c22b09ea 100644 --- a/include/beast/http/fields.hpp +++ b/include/beast/http/fields.hpp @@ -9,10 +9,10 @@ #define BEAST_HTTP_FIELDS_HPP #include +#include #include #include #include -#include #include #include #include @@ -195,14 +195,14 @@ public: /// Returns `true` if the specified field exists. bool - exists(boost::string_ref const& name) const + exists(string_view const& name) const { return set_.find(name, less{}) != set_.end(); } /// Returns the number of values for the specified field. std::size_t - count(boost::string_ref const& name) const; + count(string_view const& name) const; /** Returns an iterator to the case-insensitive matching field name. @@ -210,15 +210,15 @@ public: first field defined by insertion order is returned. */ iterator - find(boost::string_ref const& name) const; + find(string_view const& name) const; /** Returns the value for a case-insensitive matching header, or `""`. If more than one field with the specified name exists, the first field defined by insertion order is returned. */ - boost::string_ref const - operator[](boost::string_ref const& name) const; + string_view const + operator[](string_view const& name) const; /// Clear the contents of the basic_fields. void @@ -234,7 +234,7 @@ public: @return The number of fields removed. */ std::size_t - erase(boost::string_ref const& name); + erase(string_view const& name); /** Insert a field value. @@ -247,7 +247,7 @@ public: @param value A string holding the value of the field. */ void - insert(boost::string_ref const& name, boost::string_ref value); + insert(string_view const& name, string_view value); /** Insert a field value. @@ -262,8 +262,8 @@ public: */ template typename std::enable_if< - ! std::is_constructible::value>::type - insert(boost::string_ref name, T const& value) + ! std::is_constructible::value>::type + insert(string_view name, T const& value) { insert(name, boost::lexical_cast(value)); } @@ -278,7 +278,7 @@ public: @param value A string holding the value of the field. */ void - replace(boost::string_ref const& name, boost::string_ref value); + replace(string_view const& name, string_view value); /** Replace a field value. @@ -292,8 +292,8 @@ public: */ template typename std::enable_if< - ! std::is_constructible::value>::type - replace(boost::string_ref const& name, T const& value) + ! std::is_constructible::value>::type + replace(string_view const& name, T const& value) { replace(name, boost::lexical_cast(value)); @@ -303,38 +303,38 @@ public: private: #endif - boost::string_ref + string_view method() const { return (*this)[":method"]; } void - method(boost::string_ref const& s) + method(string_view const& s) { return this->replace(":method", s); } - boost::string_ref + string_view target() const { return (*this)[":target"]; } void - target(boost::string_ref const& s) + target(string_view const& s) { return this->replace(":target", s); } - boost::string_ref + string_view reason() const { return (*this)[":reason"]; } void - reason(boost::string_ref const& s) + reason(string_view const& s) { return this->replace(":reason", s); } diff --git a/include/beast/http/header_parser.hpp b/include/beast/http/header_parser.hpp index 3dc0c0d9..c4350a00 100644 --- a/include/beast/http/header_parser.hpp +++ b/include/beast/http/header_parser.hpp @@ -108,8 +108,8 @@ private: void on_request( - boost::string_ref const& method, - boost::string_ref const& path, + string_view const& method, + string_view const& path, int version, error_code&) { h_.target(path); @@ -119,7 +119,7 @@ private: void on_response(int status, - boost::string_ref const& reason, + string_view const& reason, int version, error_code&) { h_.status = status; @@ -128,8 +128,8 @@ private: } void - on_field(boost::string_ref const& name, - boost::string_ref const& value, + on_field(string_view const& name, + string_view const& value, error_code&) { h_.fields.insert(name, value); @@ -152,7 +152,7 @@ private: } void - on_data(boost::string_ref const& s, + on_data(string_view const& s, error_code& ec) { } @@ -168,7 +168,7 @@ private: void on_chunk(std::uint64_t n, - boost::string_ref const& ext, + string_view const& ext, error_code& ec) { } diff --git a/include/beast/http/impl/basic_parser.ipp b/include/beast/http/impl/basic_parser.ipp index 533fed19..0070ebed 100644 --- a/include/beast/http/impl/basic_parser.ipp +++ b/include/beast/http/impl/basic_parser.ipp @@ -261,7 +261,7 @@ consume_body(error_code& ec) template template inline -boost::string_ref +string_view basic_parser:: maybe_flatten( ConstBufferSequence const& buffers) @@ -552,7 +552,7 @@ parse_fields(char const*& it, it = term; } } - boost::string_ref value{ + string_view value{ s.data(), s.size()}; do_field(name, value, ec); if(ec) @@ -568,8 +568,8 @@ template void basic_parser:: do_field( - boost::string_ref const& name, - boost::string_ref const& value, + string_view const& name, + string_view const& value, error_code& ec) { // Connection @@ -996,7 +996,7 @@ parse_body(char const* p, std::size_t n, error_code& ec) { n = beast::detail::clamp(len_, n); - body_ = boost::string_ref{p, n}; + body_ = string_view{p, n}; impl().on_data(body_, ec); if(ec) return 0; @@ -1017,7 +1017,7 @@ basic_parser:: parse_body_to_eof(char const* p, std::size_t n, error_code& ec) { - body_ = boost::string_ref{p, n}; + body_ = string_view{p, n}; impl().on_data(body_, ec); if(ec) return 0; @@ -1032,7 +1032,7 @@ parse_chunk_body(char const* p, std::size_t n, error_code& ec) { n = beast::detail::clamp(len_, n); - body_ = boost::string_ref{p, n}; + body_ = string_view{p, n}; impl().on_data(body_, ec); if(ec) return 0; diff --git a/include/beast/http/impl/fields.ipp b/include/beast/http/impl/fields.ipp index ff9d3127..0aaafd97 100644 --- a/include/beast/http/impl/fields.ipp +++ b/include/beast/http/impl/fields.ipp @@ -170,7 +170,7 @@ basic_fields(FwdIt first, FwdIt last) template std::size_t basic_fields:: -count(boost::string_ref const& name) const +count(string_view const& name) const { auto const it = set_.find(name, less{}); if(it == set_.end()) @@ -182,7 +182,7 @@ count(boost::string_ref const& name) const template auto basic_fields:: -find(boost::string_ref const& name) const -> +find(string_view const& name) const -> iterator { auto const it = set_.find(name, less{}); @@ -192,9 +192,9 @@ find(boost::string_ref const& name) const -> } template -boost::string_ref const +string_view const basic_fields:: -operator[](boost::string_ref const& name) const +operator[](string_view const& name) const { auto const it = find(name); if(it == end()) @@ -215,7 +215,7 @@ clear() noexcept template std::size_t basic_fields:: -erase(boost::string_ref const& name) +erase(string_view const& name) { auto it = set_.find(name, less{}); if(it == set_.end()) @@ -239,8 +239,8 @@ erase(boost::string_ref const& name) template void basic_fields:: -insert(boost::string_ref const& name, - boost::string_ref value) +insert(string_view const& name, + string_view value) { value = detail::trim(value); auto const p = alloc_traits::allocate(this->member(), 1); @@ -252,8 +252,8 @@ insert(boost::string_ref const& name, template void basic_fields:: -replace(boost::string_ref const& name, - boost::string_ref value) +replace(string_view const& name, + string_view value) { value = detail::trim(value); erase(name); diff --git a/include/beast/http/impl/rfc7230.ipp b/include/beast/http/impl/rfc7230.ipp index c31638fc..151d2dda 100644 --- a/include/beast/http/impl/rfc7230.ipp +++ b/include/beast/http/impl/rfc7230.ipp @@ -17,7 +17,7 @@ namespace http { class param_list::const_iterator { - using iter_type = boost::string_ref::const_iterator; + using iter_type = string_view::const_iterator; std::string s_; detail::param_iter pi_; @@ -87,7 +87,7 @@ private: template static std::string - unquote(boost::string_ref const& sr); + unquote(string_view const& sr); template void @@ -133,7 +133,7 @@ cend() const -> template std::string param_list::const_iterator:: -unquote(boost::string_ref const& sr) +unquote(string_view const& sr) { std::string s; s.reserve(sr.size()); @@ -165,7 +165,7 @@ increment() pi_.v.second.front() == '"') { s_ = unquote(pi_.v.second); - pi_.v.second = boost::string_ref{ + pi_.v.second = string_view{ s_.data(), s_.size()}; } } @@ -346,7 +346,7 @@ increment() if(! detail::is_tchar(*it_)) break; } - v_.first = boost::string_ref{&*p0, + v_.first = string_view{&*p0, static_cast(it_ - p0)}; detail::param_iter pi; pi.it = it_; @@ -358,7 +358,7 @@ increment() if(pi.empty()) break; } - v_.second = param_list{boost::string_ref{&*it_, + v_.second = param_list{string_view{&*it_, static_cast(pi.it - it_)}}; it_ = pi.it; return; @@ -518,7 +518,7 @@ increment() if(! detail::is_tchar(*it_)) break; } - v_ = boost::string_ref{&*p0, + v_ = string_view{&*p0, static_cast(it_ - p0)}; return; } diff --git a/include/beast/http/message.hpp b/include/beast/http/message.hpp index 5d4621fb..bd04d08c 100644 --- a/include/beast/http/message.hpp +++ b/include/beast/http/message.hpp @@ -10,8 +10,8 @@ #include #include +#include #include -#include #include #include #include diff --git a/include/beast/http/message_parser.hpp b/include/beast/http/message_parser.hpp index 1b6dcc78..506dd246 100644 --- a/include/beast/http/message_parser.hpp +++ b/include/beast/http/message_parser.hpp @@ -157,8 +157,8 @@ private: void on_request( - boost::string_ref const& method, - boost::string_ref const& target, + string_view const& method, + string_view const& target, int version, error_code&) { m_.target(target); @@ -168,7 +168,7 @@ private: void on_response(int status, - boost::string_ref const& reason, + string_view const& reason, int version, error_code&) { m_.status = status; @@ -177,8 +177,8 @@ private: } void - on_field(boost::string_ref const& name, - boost::string_ref const& value, + on_field(string_view const& name, + string_view const& value, error_code&) { m_.fields.insert(name, value); @@ -223,7 +223,7 @@ private: } void - on_data(boost::string_ref const& s, + on_data(string_view const& s, error_code& ec) { static_assert(! Body::reader::is_direct, ""); @@ -244,7 +244,7 @@ private: void on_chunk(std::uint64_t, - boost::string_ref const&, + string_view const&, error_code&) { } diff --git a/include/beast/http/rfc7230.hpp b/include/beast/http/rfc7230.hpp index aa303120..b20ab920 100644 --- a/include/beast/http/rfc7230.hpp +++ b/include/beast/http/rfc7230.hpp @@ -49,7 +49,7 @@ namespace http { */ class param_list { - boost::string_ref s_; + string_view s_; public: /** The type of each element in the list. @@ -59,7 +59,7 @@ public: be empty). */ using value_type = - std::pair; + std::pair; /// A constant iterator to the list #if BEAST_DOXYGEN @@ -77,7 +77,7 @@ public: must remain valid for the lifetime of the container. */ explicit - param_list(boost::string_ref const& s) + param_list(string_view const& s) : s_(s) { } @@ -137,9 +137,9 @@ public: */ class ext_list { - using iter_type = boost::string_ref::const_iterator; + using iter_type = string_view::const_iterator; - boost::string_ref s_; + string_view s_; public: /** The type of each element in the list. @@ -148,7 +148,7 @@ public: second element of the pair is an iterable container holding the extension's name/value parameters. */ - using value_type = std::pair; + using value_type = std::pair; /// A constant iterator to the list #if BEAST_DOXYGEN @@ -163,7 +163,7 @@ public: must remain valid for the lifetime of the container. */ explicit - ext_list(boost::string_ref const& s) + ext_list(string_view const& s) : s_(s) { } @@ -230,13 +230,13 @@ public: */ class token_list { - using iter_type = boost::string_ref::const_iterator; + using iter_type = string_view::const_iterator; - boost::string_ref s_; + string_view s_; public: /// The type of each element in the token list. - using value_type = boost::string_ref; + using value_type = string_view; /// A constant iterator to the list #if BEAST_DOXYGEN @@ -251,7 +251,7 @@ public: must remain valid for the lifetime of the container. */ explicit - token_list(boost::string_ref const& s) + token_list(string_view const& s) : s_(s) { } diff --git a/include/beast/websocket/detail/hybi13.hpp b/include/beast/websocket/detail/hybi13.hpp index d2dc3fb3..7cb17c3c 100644 --- a/include/beast/websocket/detail/hybi13.hpp +++ b/include/beast/websocket/detail/hybi13.hpp @@ -9,10 +9,10 @@ #define BEAST_WEBSOCKET_DETAIL_HYBI13_HPP #include +#include #include #include #include -#include #include #include #include @@ -49,7 +49,7 @@ make_sec_ws_key(sec_ws_key_type& key, Gen& g) template void make_sec_ws_accept(sec_ws_accept_type& accept, - boost::string_ref key) + string_view key) { BOOST_ASSERT(key.size() <= sec_ws_key_type::max_size_n); static_string m(key); diff --git a/include/beast/websocket/detail/pmd_extension.hpp b/include/beast/websocket/detail/pmd_extension.hpp index e7c087a3..b8fb8bcb 100644 --- a/include/beast/websocket/detail/pmd_extension.hpp +++ b/include/beast/websocket/detail/pmd_extension.hpp @@ -46,7 +46,7 @@ struct pmd_offer template int -parse_bits(boost::string_ref const& s) +parse_bits(string_view const& s) { if(s.size() == 0) return -1; diff --git a/include/beast/websocket/impl/handshake.ipp b/include/beast/websocket/impl/handshake.ipp index 337f128f..2e84bf21 100644 --- a/include/beast/websocket/impl/handshake.ipp +++ b/include/beast/websocket/impl/handshake.ipp @@ -42,8 +42,8 @@ class stream::handshake_op template data(Handler& handler, stream& ws_, response_type* res_p_, - boost::string_ref const& host, - boost::string_ref const& target, + string_view const& host, + string_view const& target, Decorator const& decorator) : cont(beast_asio_helpers:: is_continuation(handler)) @@ -163,8 +163,8 @@ template typename async_completion::result_type stream:: -async_handshake(boost::string_ref const& host, - boost::string_ref const& target, +async_handshake(string_view const& host, + string_view const& target, HandshakeHandler&& handler) { static_assert(is_AsyncStream::value, @@ -183,8 +183,8 @@ typename async_completion::result_type stream:: async_handshake(response_type& res, - boost::string_ref const& host, - boost::string_ref const& target, + string_view const& host, + string_view const& target, HandshakeHandler&& handler) { static_assert(is_AsyncStream::value, @@ -202,8 +202,8 @@ template typename async_completion::result_type stream:: -async_handshake_ex(boost::string_ref const& host, - boost::string_ref const& target, +async_handshake_ex(string_view const& host, + string_view const& target, RequestDecorator const& decorator, HandshakeHandler&& handler) { @@ -226,8 +226,8 @@ typename async_completion::result_type stream:: async_handshake_ex(response_type& res, - boost::string_ref const& host, - boost::string_ref const& target, + string_view const& host, + string_view const& target, RequestDecorator const& decorator, HandshakeHandler&& handler) { @@ -247,8 +247,8 @@ async_handshake_ex(response_type& res, template void stream:: -handshake(boost::string_ref const& host, - boost::string_ref const& target) +handshake(string_view const& host, + string_view const& target) { static_assert(is_SyncStream::value, "SyncStream requirements not met"); @@ -263,8 +263,8 @@ template void stream:: handshake(response_type& res, - boost::string_ref const& host, - boost::string_ref const& target) + string_view const& host, + string_view const& target) { static_assert(is_SyncStream::value, "SyncStream requirements not met"); @@ -278,8 +278,8 @@ template template void stream:: -handshake_ex(boost::string_ref const& host, - boost::string_ref const& target, +handshake_ex(string_view const& host, + string_view const& target, RequestDecorator const& decorator) { static_assert(is_SyncStream::value, @@ -298,8 +298,8 @@ template void stream:: handshake_ex(response_type& res, - boost::string_ref const& host, - boost::string_ref const& target, + string_view const& host, + string_view const& target, RequestDecorator const& decorator) { static_assert(is_SyncStream::value, @@ -316,8 +316,8 @@ handshake_ex(response_type& res, template void stream:: -handshake(boost::string_ref const& host, - boost::string_ref const& target, error_code& ec) +handshake(string_view const& host, + string_view const& target, error_code& ec) { static_assert(is_SyncStream::value, "SyncStream requirements not met"); @@ -329,8 +329,8 @@ template void stream:: handshake(response_type& res, - boost::string_ref const& host, - boost::string_ref const& target, + string_view const& host, + string_view const& target, error_code& ec) { static_assert(is_SyncStream::value, @@ -343,8 +343,8 @@ template template void stream:: -handshake_ex(boost::string_ref const& host, - boost::string_ref const& target, +handshake_ex(string_view const& host, + string_view const& target, RequestDecorator const& decorator, error_code& ec) { @@ -362,8 +362,8 @@ template void stream:: handshake_ex(response_type& res, - boost::string_ref const& host, - boost::string_ref const& target, + string_view const& host, + string_view const& target, RequestDecorator const& decorator, error_code& ec) { diff --git a/include/beast/websocket/impl/stream.ipp b/include/beast/websocket/impl/stream.ipp index ec44014f..e28d7be8 100644 --- a/include/beast/websocket/impl/stream.ipp +++ b/include/beast/websocket/impl/stream.ipp @@ -127,8 +127,8 @@ template void stream:: do_handshake(response_type* res_p, - boost::string_ref const& host, - boost::string_ref const& target, + string_view const& host, + string_view const& target, RequestDecorator const& decorator, error_code& ec) { @@ -156,8 +156,8 @@ template request_type stream:: build_request(detail::sec_ws_key_type& key, - boost::string_ref const& host, - boost::string_ref const& target, + string_view const& host, + string_view const& target, Decorator const& decorator) { request_type req; diff --git a/include/beast/websocket/stream.hpp b/include/beast/websocket/stream.hpp index 04ba0799..94ababfc 100644 --- a/include/beast/websocket/stream.hpp +++ b/include/beast/websocket/stream.hpp @@ -16,9 +16,9 @@ #include #include #include +#include #include #include -#include #include #include #include @@ -1465,8 +1465,8 @@ public: @endcode */ void - handshake(boost::string_ref const& host, - boost::string_ref const& target); + handshake(string_view const& host, + string_view const& target); /** Send an HTTP WebSocket Upgrade request and receive the response. @@ -1514,8 +1514,8 @@ public: */ void handshake(response_type& res, - boost::string_ref const& host, - boost::string_ref const& target); + string_view const& host, + string_view const& target); /** Send an HTTP WebSocket Upgrade request and receive the response. @@ -1572,8 +1572,8 @@ public: */ template void - handshake_ex(boost::string_ref const& host, - boost::string_ref const& target, + handshake_ex(string_view const& host, + string_view const& target, RequestDecorator const& decorator); /** Send an HTTP WebSocket Upgrade request and receive the response. @@ -1636,8 +1636,8 @@ public: template void handshake_ex(response_type& res, - boost::string_ref const& host, - boost::string_ref const& target, + string_view const& host, + string_view const& target, RequestDecorator const& decorator); /** Send an HTTP WebSocket Upgrade request and receive the response. @@ -1679,8 +1679,8 @@ public: @endcode */ void - handshake(boost::string_ref const& host, - boost::string_ref const& target, error_code& ec); + handshake(string_view const& host, + string_view const& target, error_code& ec); /** Send an HTTP WebSocket Upgrade request and receive the response. @@ -1726,8 +1726,8 @@ public: */ void handshake(response_type& res, - boost::string_ref const& host, - boost::string_ref const& target, + string_view const& host, + string_view const& target, error_code& ec); /** Send an HTTP WebSocket Upgrade request and receive the response. @@ -1784,8 +1784,8 @@ public: */ template void - handshake_ex(boost::string_ref const& host, - boost::string_ref const& target, + handshake_ex(string_view const& host, + string_view const& target, RequestDecorator const& decorator, error_code& ec); @@ -1848,8 +1848,8 @@ public: template void handshake_ex(response_type& res, - boost::string_ref const& host, - boost::string_ref const& target, + string_view const& host, + string_view const& target, RequestDecorator const& decorator, error_code& ec); @@ -1901,8 +1901,8 @@ public: typename async_completion::result_type #endif - async_handshake(boost::string_ref const& host, - boost::string_ref const& target, + async_handshake(string_view const& host, + string_view const& target, HandshakeHandler&& handler); /** Start an asynchronous operation to send an upgrade request and receive the response. @@ -1958,8 +1958,8 @@ public: void(error_code)>::result_type #endif async_handshake(response_type& res, - boost::string_ref const& host, - boost::string_ref const& target, + string_view const& host, + string_view const& target, HandshakeHandler&& handler); /** Start an asynchronous operation to send an upgrade request and receive the response. @@ -2019,8 +2019,8 @@ public: typename async_completion::result_type #endif - async_handshake_ex(boost::string_ref const& host, - boost::string_ref const& target, + async_handshake_ex(string_view const& host, + string_view const& target, RequestDecorator const& decorator, HandshakeHandler&& handler); @@ -2086,8 +2086,8 @@ public: void(error_code)>::result_type #endif async_handshake_ex(response_type& res, - boost::string_ref const& host, - boost::string_ref const& target, + string_view const& host, + string_view const& target, RequestDecorator const& decorator, HandshakeHandler&& handler); @@ -2968,16 +2968,16 @@ private: template void do_handshake(response_type* res_p, - boost::string_ref const& host, - boost::string_ref const& target, + string_view const& host, + string_view const& target, RequestDecorator const& decorator, error_code& ec); template request_type build_request(detail::sec_ws_key_type& key, - boost::string_ref const& host, - boost::string_ref const& target, + string_view const& host, + string_view const& target, Decorator const& decorator); template diff --git a/test/Jamfile b/test/Jamfile index 67e980a3..24ce66d2 100644 --- a/test/Jamfile +++ b/test/Jamfile @@ -37,6 +37,7 @@ unit-test core-tests : core/static_buffer.cpp core/static_string.cpp core/stream_concepts.cpp + core/string_view.cpp core/base64.cpp core/empty_base_optimization.cpp core/get_lowest_layer.cpp diff --git a/test/core/CMakeLists.txt b/test/core/CMakeLists.txt index 41d137aa..63cc9914 100644 --- a/test/core/CMakeLists.txt +++ b/test/core/CMakeLists.txt @@ -30,6 +30,7 @@ add_executable (core-tests static_buffer.cpp static_string.cpp stream_concepts.cpp + string_view.cpp base64.cpp empty_base_optimization.cpp get_lowest_layer.cpp diff --git a/test/core/static_string.cpp b/test/core/static_string.cpp index bb907fae..ade4d50e 100644 --- a/test/core/static_string.cpp +++ b/test/core/static_string.cpp @@ -123,13 +123,13 @@ public: } { static_string<3> s1( - boost::string_ref("123")); + string_view("123")); BEAST_EXPECT(s1 == "123"); BEAST_EXPECT(*s1.end() == 0); try { static_string<2> s2( - boost::string_ref("123")); + string_view("123")); fail("", __FILE__, __LINE__); } catch(std::length_error const&) @@ -232,13 +232,13 @@ public: } { static_string<3> s1; - s1 = boost::string_ref("123"); + s1 = string_view("123"); BEAST_EXPECT(s1 == "123"); BEAST_EXPECT(*s1.end() == 0); try { static_string<1> s2; - s2 = boost::string_ref("123"); + s2 = string_view("123"); fail("", __FILE__, __LINE__); } catch(std::length_error const&) @@ -370,15 +370,15 @@ public: } { static_string<5> s1; - s1.assign(boost::string_ref("123")); + s1.assign(string_view("123")); BEAST_EXPECT(s1 == "123"); BEAST_EXPECT(*s1.end() == 0); - s1.assign(boost::string_ref("12345")); + s1.assign(string_view("12345")); BEAST_EXPECT(s1 == "12345"); BEAST_EXPECT(*s1.end() == 0); try { - s1.assign(boost::string_ref("1234567")); + s1.assign(string_view("1234567")); fail("", __FILE__, __LINE__); } catch(std::length_error const&) @@ -483,7 +483,7 @@ public: } { static_string<3> s("123"); - boost::string_ref sv = s; + string_view sv = s; BEAST_EXPECT(static_string<5>(sv) == "123"); } } @@ -750,13 +750,13 @@ public: } { static_string<5> s1("123"); - s1.insert(1, boost::string_ref("UV")); + s1.insert(1, string_view("UV")); BEAST_EXPECT(s1 == "1UV23"); BEAST_EXPECT(*s1.end() == 0); try { static_string<4> s2("123"); - s2.insert(1, boost::string_ref("UV")); + s2.insert(1, string_view("UV")); fail("", __FILE__, __LINE__); } catch(std::length_error const&) @@ -766,7 +766,7 @@ public: try { static_string<5> s2("123"); - s2.insert(5, boost::string_ref("UV")); + s2.insert(5, string_view("UV")); fail("", __FILE__, __LINE__); } catch(std::out_of_range const&) @@ -1024,7 +1024,7 @@ public: } } { - boost::string_ref s1("XYZ"); + string_view s1("XYZ"); static_string<5> s2("12"); s2.append(s1); BEAST_EXPECT(s2 == "12XYZ"); @@ -1124,7 +1124,7 @@ public: } } { - boost::string_ref s1("34"); + string_view s1("34"); static_string<4> s2("12"); s2 += s1; BEAST_EXPECT(s2 == "1234"); diff --git a/test/core/string_view.cpp b/test/core/string_view.cpp new file mode 100644 index 00000000..b97e888f --- /dev/null +++ b/test/core/string_view.cpp @@ -0,0 +1,9 @@ +// +// Copyright (c) 2013-2017 Vinnie Falco (vinnie dot falco at gmail dot com) +// +// Distributed under the Boost Software License, Version 1.0. (See accompanying +// file LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt) +// + +// Test that header file is self-contained. +#include diff --git a/test/http/basic_parser.cpp b/test/http/basic_parser.cpp index 86fa7163..05f41be2 100644 --- a/test/http/basic_parser.cpp +++ b/test/http/basic_parser.cpp @@ -218,7 +218,7 @@ public: template void - good(boost::string_ref const& s, + good(string_view const& s, Pred const& pred, bool skipBody = false) { using boost::asio::buffer; @@ -240,7 +240,7 @@ public: template void - good(boost::string_ref const& s) + good(string_view const& s) { good(s, [](test_parser const&) @@ -250,7 +250,7 @@ public: template void - bad(boost::string_ref const& s, + bad(string_view const& s, error_code const& ev, bool skipBody = false) { using boost::asio::buffer; diff --git a/test/http/design.cpp b/test/http/design.cpp index e21bd984..b44acdcc 100644 --- a/test/http/design.cpp +++ b/test/http/design.cpp @@ -176,7 +176,7 @@ public: } void - write(boost::string_ref const& s, + write(string_view const& s, error_code& ec) { body_.append(s.data(), s.size()); @@ -464,7 +464,7 @@ public: struct bodyHandler { void - operator()(boost::string_ref const& body) const + operator()(string_view const& body) const { // called for each piece of the body, } diff --git a/test/http/message_fuzz.hpp b/test/http/message_fuzz.hpp index f199f4d5..3e6ff075 100644 --- a/test/http/message_fuzz.hpp +++ b/test/http/message_fuzz.hpp @@ -19,7 +19,7 @@ namespace http { template std::string -escaped_string(boost::string_ref const& s) +escaped_string(string_view const& s) { std::string out; out.reserve(s.size()); diff --git a/test/http/parser_bench.cpp b/test/http/parser_bench.cpp index ea2d1f53..3af58262 100644 --- a/test/http/parser_bench.cpp +++ b/test/http/parser_bench.cpp @@ -168,22 +168,22 @@ public: boost::asio::mutable_buffers_1; void - on_request(boost::string_ref const&, - boost::string_ref const&, + on_request(string_view const&, + string_view const&, int, error_code&) { } void on_response(int, - boost::string_ref const&, + string_view const&, int, error_code&) { } void - on_field(boost::string_ref const&, - boost::string_ref const&, + on_field(string_view const&, + string_view const&, error_code&) { } @@ -205,20 +205,20 @@ public: } void - on_data(boost::string_ref const&, + on_data(string_view const&, error_code& ec) { } void on_chunk(std::uint64_t, - boost::string_ref const&, + string_view const&, error_code&) { } void - on_body(boost::string_ref const&, + on_body(string_view const&, error_code&) { } diff --git a/test/http/rfc7230.cpp b/test/http/rfc7230.cpp index a02b2cc7..546398ce 100644 --- a/test/http/rfc7230.cpp +++ b/test/http/rfc7230.cpp @@ -30,7 +30,7 @@ public: static std::string - str(boost::string_ref const& s) + str(string_view const& s) { return std::string(s.data(), s.size()); } @@ -241,7 +241,7 @@ public: template static std::vector - to_vector(boost::string_ref const& in) + to_vector(string_view const& in) { std::vector v; detail::basic_parsed_list list{in}; @@ -253,7 +253,7 @@ public: template void - validate(boost::string_ref const& in, + validate(string_view const& in, std::vector const& v) { BEAST_EXPECT(to_vector(in) == v); @@ -261,7 +261,7 @@ public: template void - good(boost::string_ref const& in) + good(string_view const& in) { BEAST_EXPECT(validate_list( detail::basic_parsed_list{in})); @@ -269,7 +269,7 @@ public: template void - good(boost::string_ref const& in, + good(string_view const& in, std::vector const& v) { BEAST_EXPECT(validate_list( @@ -279,7 +279,7 @@ public: template void - bad(boost::string_ref const& in) + bad(string_view const& in) { BEAST_EXPECT(! validate_list( detail::basic_parsed_list{in})); diff --git a/test/http/test_parser.hpp b/test/http/test_parser.hpp index 7d2611c2..94e3a9ed 100644 --- a/test/http/test_parser.hpp +++ b/test/http/test_parser.hpp @@ -51,8 +51,8 @@ public: void on_request( - boost::string_ref const& method_, - boost::string_ref const& path_, + string_view const& method_, + string_view const& path_, int version_, error_code& ec) { method = std::string( @@ -67,7 +67,7 @@ public: void on_response(int status_, - boost::string_ref const& reason_, + string_view const& reason_, int version_, error_code& ec) { status = status_; @@ -80,8 +80,8 @@ public: } void - on_field(boost::string_ref const&, - boost::string_ref const&, + on_field(string_view const&, + string_view const&, error_code& ec) { got_on_field = true; @@ -116,7 +116,7 @@ public: } void - on_data(boost::string_ref const& s, + on_data(string_view const& s, error_code& ec) { body.append(s.data(), s.size()); @@ -124,7 +124,7 @@ public: void on_chunk(std::uint64_t, - boost::string_ref const&, + string_view const&, error_code& ec) { got_on_chunk = true; diff --git a/test/websocket/stream.cpp b/test/websocket/stream.cpp index 08a85531..4326108e 100644 --- a/test/websocket/stream.cpp +++ b/test/websocket/stream.cpp @@ -198,8 +198,8 @@ public: template void handshake(stream& ws, - boost::string_ref const& uri, - boost::string_ref const& path) const + string_view const& uri, + string_view const& path) const { ws.handshake(uri, path); } @@ -208,8 +208,8 @@ public: void handshake(stream& ws, response_type& res, - boost::string_ref const& uri, - boost::string_ref const& path) const + string_view const& uri, + string_view const& path) const { ws.handshake(res, uri, path); } @@ -217,8 +217,8 @@ public: template void handshake_ex(stream& ws, - boost::string_ref const& uri, - boost::string_ref const& path, + string_view const& uri, + string_view const& path, Decorator const& d) const { ws.handshake_ex(uri, path, d); @@ -228,8 +228,8 @@ public: void handshake_ex(stream& ws, response_type& res, - boost::string_ref const& uri, - boost::string_ref const& path, + string_view const& uri, + string_view const& path, Decorator const& d) const { ws.handshake_ex(res, uri, path, d); @@ -409,8 +409,8 @@ public: template void handshake(stream& ws, - boost::string_ref const& uri, - boost::string_ref const& path) const + string_view const& uri, + string_view const& path) const { error_code ec; ws.async_handshake( @@ -423,8 +423,8 @@ public: void handshake(stream& ws, response_type& res, - boost::string_ref const& uri, - boost::string_ref const& path) const + string_view const& uri, + string_view const& path) const { error_code ec; ws.async_handshake( @@ -436,8 +436,8 @@ public: template void handshake_ex(stream& ws, - boost::string_ref const& uri, - boost::string_ref const& path, + string_view const& uri, + string_view const& path, Decorator const &d) const { error_code ec; @@ -451,8 +451,8 @@ public: void handshake_ex(stream& ws, response_type& res, - boost::string_ref const& uri, - boost::string_ref const& path, + string_view const& uri, + string_view const& path, Decorator const &d) const { error_code ec;