2016-11-20 07:32:41 -05:00
|
|
|
//
|
2019-02-21 07:00:31 -08:00
|
|
|
// Copyright (c) 2016-2019 Vinnie Falco (vinnie dot falco at gmail dot com)
|
2016-11-20 07:32:41 -05:00
|
|
|
//
|
|
|
|
|
// 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)
|
|
|
|
|
//
|
2017-07-20 13:40:34 -07:00
|
|
|
// Official repository: https://github.com/boostorg/beast
|
|
|
|
|
//
|
2016-11-20 07:32:41 -05:00
|
|
|
|
2019-02-22 13:06:43 -08:00
|
|
|
#ifndef BOOST_BEAST_HTTP_IMPL_PARSER_HPP
|
|
|
|
|
#define BOOST_BEAST_HTTP_IMPL_PARSER_HPP
|
2016-11-20 07:32:41 -05:00
|
|
|
|
2017-06-05 06:44:31 -07:00
|
|
|
#include <boost/throw_exception.hpp>
|
|
|
|
|
#include <stdexcept>
|
|
|
|
|
|
2017-07-20 13:40:34 -07:00
|
|
|
namespace boost {
|
2016-11-20 07:32:41 -05:00
|
|
|
namespace beast {
|
|
|
|
|
namespace http {
|
|
|
|
|
|
2017-07-07 20:08:52 -07:00
|
|
|
template<bool isRequest, class Body, class Allocator>
|
|
|
|
|
parser<isRequest, Body, Allocator>::
|
|
|
|
|
parser()
|
2017-11-13 23:34:14 +01:00
|
|
|
: rd_(m_.base(), m_.body())
|
|
|
|
|
{
|
2017-07-07 20:08:52 -07:00
|
|
|
}
|
|
|
|
|
|
2017-06-19 11:54:53 -07:00
|
|
|
template<bool isRequest, class Body, class Allocator>
|
2016-11-20 07:32:41 -05:00
|
|
|
template<class Arg1, class... ArgN, class>
|
2017-06-19 11:54:53 -07:00
|
|
|
parser<isRequest, Body, Allocator>::
|
2017-06-03 08:56:21 -07:00
|
|
|
parser(Arg1&& arg1, ArgN&&... argn)
|
2018-05-04 12:46:49 -07:00
|
|
|
: m_(
|
|
|
|
|
std::forward<Arg1>(arg1),
|
2017-11-13 23:34:14 +01:00
|
|
|
std::forward<ArgN>(argn)...)
|
|
|
|
|
, rd_(m_.base(), m_.body())
|
|
|
|
|
{
|
|
|
|
|
m_.clear();
|
2016-11-20 07:32:41 -05:00
|
|
|
}
|
|
|
|
|
|
2017-06-19 11:54:53 -07:00
|
|
|
template<bool isRequest, class Body, class Allocator>
|
2017-06-05 07:20:58 -07:00
|
|
|
template<class OtherBody, class... Args, class>
|
2017-06-19 11:54:53 -07:00
|
|
|
parser<isRequest, Body, Allocator>::
|
2017-11-13 23:34:14 +01:00
|
|
|
parser(
|
|
|
|
|
parser<isRequest, OtherBody, Allocator>&& other,
|
|
|
|
|
Args&&... args)
|
2019-02-23 06:55:12 -08:00
|
|
|
: basic_parser<isRequest>(std::move(other))
|
2017-11-13 23:34:14 +01:00
|
|
|
, m_(other.release(), std::forward<Args>(args)...)
|
|
|
|
|
, rd_(m_.base(), m_.body())
|
|
|
|
|
{
|
|
|
|
|
if(other.rd_inited_)
|
|
|
|
|
BOOST_THROW_EXCEPTION(std::invalid_argument{
|
|
|
|
|
"moved-from parser has a body"});
|
2017-06-05 06:44:31 -07:00
|
|
|
}
|
|
|
|
|
|
2016-11-20 07:32:41 -05:00
|
|
|
} // http
|
|
|
|
|
} // beast
|
2017-07-20 13:40:34 -07:00
|
|
|
} // boost
|
2016-11-20 07:32:41 -05:00
|
|
|
|
|
|
|
|
#endif
|