20 #ifndef BEAST_RFC2616_HPP
21 #define BEAST_RFC2616_HPP
23 #include <boost/beast/http/message.hpp>
24 #include <boost/beast/http/rfc7230.hpp>
25 #include <boost/range/algorithm/equal.hpp>
26 #include <boost/range/iterator_range.hpp>
27 #include <boost/utility/string_ref.hpp>
48 return std::tolower(
static_cast<unsigned char>(c1)) ==
49 std::tolower(
static_cast<unsigned char>(c2));
60 return c ==
' ' || c ==
'\t';
80 template <
class FwdIter>
91 }
while (last != first);
95 template <
class String>
101 auto first(begin(s));
104 return {first, last};
123 split(FwdIt first, FwdIt last, Char delim)
125 using namespace detail;
126 using string =
typename Result::value_type;
151 e.append(1, *iter++);
156 e.append(1, *iter++);
161 result.emplace_back(std::move(e));
165 else if (*iter == delim)
170 result.emplace_back(std::move(e));
175 else if (is_lws(*iter))
181 e.append(1, *iter++);
189 result.emplace_back(std::move(e));
201 return split(first, last,
',');
204 template <
class Result = std::vector<std::
string>>
245 return other.
it_ == it_ && other.
end_ == end_ &&
246 other.
value_.size() == value_.size();
252 return !(*
this == other);
283 template <
class =
void>
292 using namespace detail;
310 value_ = boost::string_ref(
316 value_ = boost::string_ref(
325 else if (*it_ ==
',')
330 else if (is_lws(*it_))
341 if (it_ == end_ || *it_ ==
',' || is_lws(*it_))
356 ci_equal(boost::string_ref s1, boost::string_ref s2)
362 inline boost::iterator_range<list_iterator>
365 return boost::iterator_range<list_iterator>{
374 template <
class =
void>
376 token_in_list(boost::string_ref
const& value, boost::string_ref
const& token)
378 for (
auto const& item :
make_list(value))
384 template <
bool isRequest,
class Body,
class Fields>
386 is_keep_alive(boost::beast::http::message<isRequest, Body, Fields>
const& m)
388 if (m.version() <= 10)
389 return boost::beast::http::token_list{
390 m[boost::beast::http::field::connection]}
391 .exists(
"keep-alive");
392 return !boost::beast::http::token_list{
393 m[boost::beast::http::field::connection]}