summaryrefslogtreecommitdiff
path: root/boost/beast/http/detail
diff options
context:
space:
mode:
Diffstat (limited to 'boost/beast/http/detail')
-rw-r--r--boost/beast/http/detail/basic_parser.hpp35
-rw-r--r--boost/beast/http/detail/chunk_encode.hpp4
-rw-r--r--boost/beast/http/detail/type_traits.hpp20
3 files changed, 24 insertions, 35 deletions
diff --git a/boost/beast/http/detail/basic_parser.hpp b/boost/beast/http/detail/basic_parser.hpp
index 0936862add..818277bea5 100644
--- a/boost/beast/http/detail/basic_parser.hpp
+++ b/boost/beast/http/detail/basic_parser.hpp
@@ -19,6 +19,7 @@
#include <boost/version.hpp>
#include <algorithm>
#include <cstddef>
+#include <limits>
#include <utility>
namespace boost {
@@ -26,9 +27,8 @@ namespace beast {
namespace http {
namespace detail {
-class basic_parser_base
+struct basic_parser_base
{
-protected:
// limit on the size of the obs-fold buffer
//
// https://stackoverflow.com/questions/686217/maximum-on-http-header-values
@@ -299,25 +299,30 @@ protected:
return p;
}
- template<class Iter, class Unsigned>
+ template<class Iter, class T>
static
- bool
- parse_dec(Iter it, Iter last, Unsigned& v)
+ typename std::enable_if<
+ std::numeric_limits<T>::is_integer &&
+ ! std::numeric_limits<T>::is_signed, bool>::type
+ parse_dec(Iter it, Iter last, T& v)
{
- if(! is_digit(*it))
+ if(it == last)
return false;
- v = *it - '0';
- for(;;)
+ T tmp = 0;
+ do
{
- if(! is_digit(*++it))
- break;
- auto const d = *it - '0';
- if(v > ((std::numeric_limits<
- Unsigned>::max)() - 10) / 10)
+ if((! is_digit(*it)) ||
+ tmp > (std::numeric_limits<T>::max)() / 10)
return false;
- v = 10 * v + d;
+ tmp *= 10;
+ T const d = *it - '0';
+ if((std::numeric_limits<T>::max)() - tmp < d)
+ return false;
+ tmp += d;
}
- return it == last;
+ while(++it != last);
+ v = tmp;
+ return true;
}
template<class Iter, class Unsigned>
diff --git a/boost/beast/http/detail/chunk_encode.hpp b/boost/beast/http/detail/chunk_encode.hpp
index cad48418d9..87ac9ec41e 100644
--- a/boost/beast/http/detail/chunk_encode.hpp
+++ b/boost/beast/http/detail/chunk_encode.hpp
@@ -57,8 +57,8 @@ struct is_chunk_extensions : std::false_type {};
template<class T>
struct is_chunk_extensions<T, beast::detail::void_t<decltype(
- std::declval<string_view&>() = std::declval<T&>().str(),
- (void)0)>> : std::true_type
+ std::declval<string_view&>() = std::declval<T&>().str()
+ )>> : std::true_type
{
};
diff --git a/boost/beast/http/detail/type_traits.hpp b/boost/beast/http/detail/type_traits.hpp
index 1d0c991826..b849446b0f 100644
--- a/boost/beast/http/detail/type_traits.hpp
+++ b/boost/beast/http/detail/type_traits.hpp
@@ -93,8 +93,8 @@ struct is_body_sized<T, beast::detail::void_t<
typename T::value_type,
decltype(
std::declval<std::uint64_t&>() =
- T::size(std::declval<typename T::value_type const&>()),
- (void)0)>> : std::true_type {};
+ T::size(std::declval<typename T::value_type const&>())
+ )>> : std::true_type {};
template<class T>
struct is_fields_helper : T
@@ -194,22 +194,6 @@ struct is_fields_helper : T
t10::value && t11::value && t12::value>;
};
-template<class T>
-using has_deprecated_body_writer =
- std::integral_constant<bool,
- std::is_constructible<typename T::writer,
- message<true, T, detail::fields_model>&>::value &&
- std::is_constructible<typename T::writer,
- message<false, T, detail::fields_model>&>::value>;
-
-template<class T>
-using has_deprecated_body_reader =
- std::integral_constant<bool,
- std::is_constructible<typename T::reader,
- message<true, T, detail::fields_model>&>::value &&
- std::is_constructible<typename T::reader,
- message<false, T, detail::fields_model>&>::value>;
-
} // detail
} // http
} // beast