20 #ifndef BEAST_RFC2616_HPP
21 #define BEAST_RFC2616_HPP
27 #include <boost/beast/http/message.hpp>
28 #include <boost/beast/http/rfc7230.hpp>
29 #include <boost/range/algorithm/equal.hpp>
30 #include <boost/range/iterator_range.hpp>
31 #include <boost/utility/string_ref.hpp>
53 return std::tolower(
static_cast<unsigned char>(c1)) ==
54 std::tolower(
static_cast<unsigned char>(c2));
65 return c ==
' ' || c ==
'\t';
85 template <
class FwdIter>
96 }
while (last != first);
100 template <
class String>
106 auto first(begin(s));
109 return {first, last};
128 split(FwdIt first, FwdIt last, Char delim)
130 using namespace detail;
131 using string =
typename Result::value_type;
156 e.append(1, *iter++);
161 e.append(1, *iter++);
166 result.emplace_back(std::move(e));
170 else if (*iter == delim)
175 result.emplace_back(std::move(e));
180 else if (is_lws(*iter))
186 e.append(1, *iter++);
194 result.emplace_back(std::move(e));
206 return split(first, last,
',');
209 template <
class Result = std::vector<std::
string>>
250 return other.
it_ == it_ && other.
end_ == end_ &&
251 other.
value_.size() == value_.size();
257 return !(*
this == other);
288 template <
class =
void>
297 using namespace detail;
315 value_ = boost::string_ref(
321 value_ = boost::string_ref(
330 else if (*it_ ==
',')
335 else if (is_lws(*it_))
346 if (it_ == end_ || *it_ ==
',' || is_lws(*it_))
361 ci_equal(boost::string_ref s1, boost::string_ref s2)
367 inline boost::iterator_range<list_iterator>
370 return boost::iterator_range<list_iterator>{
379 template <
class =
void>
381 token_in_list(boost::string_ref
const& value, boost::string_ref
const& token)
383 for (
auto const& item :
make_list(value))
389 template <
bool isRequest,
class Body,
class Fields>
391 is_keep_alive(boost::beast::http::message<isRequest, Body, Fields>
const& m)
393 if (m.version() <= 10)
394 return boost::beast::http::token_list{
395 m[boost::beast::http::field::connection]}
396 .exists(
"keep-alive");
397 return !boost::beast::http::token_list{
398 m[boost::beast::http::field::connection]}