mirror of
https://github.com/boostorg/beast.git
synced 2025-07-30 12:57:31 +02:00
@ -1,3 +1,9 @@
|
|||||||
|
Version 181:
|
||||||
|
|
||||||
|
* Fix parse_dec algorithm
|
||||||
|
|
||||||
|
--------------------------------------------------------------------------------
|
||||||
|
|
||||||
Version 180:
|
Version 180:
|
||||||
|
|
||||||
* Fix http_server_stackless_ssl.cpp example
|
* Fix http_server_stackless_ssl.cpp example
|
||||||
|
@ -74,6 +74,8 @@ in future versions.
|
|||||||
|
|
||||||
* ([issue 1210]) Fix http_server_stackless_ssl.cpp example
|
* ([issue 1210]) Fix http_server_stackless_ssl.cpp example
|
||||||
|
|
||||||
|
* ([issue 1211]) Fix parse_dec algorithm
|
||||||
|
|
||||||
* Tidy up websocket stream javadocs
|
* Tidy up websocket stream javadocs
|
||||||
|
|
||||||
* Fix move-only arguments in [link beast.ref.boost__beast__bind_handler `bind_handler`]
|
* Fix move-only arguments in [link beast.ref.boost__beast__bind_handler `bind_handler`]
|
||||||
|
@ -19,6 +19,7 @@
|
|||||||
#include <boost/version.hpp>
|
#include <boost/version.hpp>
|
||||||
#include <algorithm>
|
#include <algorithm>
|
||||||
#include <cstddef>
|
#include <cstddef>
|
||||||
|
#include <limits>
|
||||||
#include <utility>
|
#include <utility>
|
||||||
|
|
||||||
namespace boost {
|
namespace boost {
|
||||||
@ -26,9 +27,8 @@ namespace beast {
|
|||||||
namespace http {
|
namespace http {
|
||||||
namespace detail {
|
namespace detail {
|
||||||
|
|
||||||
class basic_parser_base
|
struct basic_parser_base
|
||||||
{
|
{
|
||||||
protected:
|
|
||||||
// limit on the size of the obs-fold buffer
|
// limit on the size of the obs-fold buffer
|
||||||
//
|
//
|
||||||
// https://stackoverflow.com/questions/686217/maximum-on-http-header-values
|
// https://stackoverflow.com/questions/686217/maximum-on-http-header-values
|
||||||
@ -299,25 +299,30 @@ protected:
|
|||||||
return p;
|
return p;
|
||||||
}
|
}
|
||||||
|
|
||||||
template<class Iter, class Unsigned>
|
template<class Iter, class T>
|
||||||
static
|
static
|
||||||
bool
|
typename std::enable_if<
|
||||||
parse_dec(Iter it, Iter last, Unsigned& v)
|
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;
|
return false;
|
||||||
v = *it - '0';
|
T tmp = 0;
|
||||||
for(;;)
|
do
|
||||||
{
|
{
|
||||||
if(! is_digit(*++it))
|
if((! is_digit(*it)) ||
|
||||||
break;
|
tmp > (std::numeric_limits<T>::max)() / 10)
|
||||||
auto const d = *it - '0';
|
|
||||||
if(v > ((std::numeric_limits<
|
|
||||||
Unsigned>::max)() - 10) / 10)
|
|
||||||
return false;
|
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>
|
template<class Iter, class Unsigned>
|
||||||
|
Reference in New Issue
Block a user