2016-11-20 07:32:41 -05:00
|
|
|
//
|
|
|
|
|
// Copyright (c) 2013-2017 Vinnie Falco (vinnie dot falco at gmail dot com)
|
|
|
|
|
//
|
|
|
|
|
// 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-06-03 08:40:53 -07:00
|
|
|
#ifndef BEAST_HTTP_IMPL_PARSER_IPP
|
|
|
|
|
#define BEAST_HTTP_IMPL_PARSER_IPP
|
2016-11-20 07:32:41 -05:00
|
|
|
|
2017-06-05 06:44:31 -07:00
|
|
|
#include <boost/throw_exception.hpp>
|
|
|
|
|
#include <stdexcept>
|
|
|
|
|
|
2016-11-20 07:32:41 -05:00
|
|
|
namespace beast {
|
|
|
|
|
namespace http {
|
|
|
|
|
|
|
|
|
|
template<bool isRequest, class Body, class Fields>
|
|
|
|
|
template<class Arg1, class... ArgN, class>
|
2017-06-03 08:56:21 -07:00
|
|
|
parser<isRequest, Body, Fields>::
|
|
|
|
|
parser(Arg1&& arg1, ArgN&&... argn)
|
2016-11-20 07:32:41 -05:00
|
|
|
: m_(std::forward<Arg1>(arg1),
|
|
|
|
|
std::forward<ArgN>(argn)...)
|
|
|
|
|
{
|
|
|
|
|
}
|
|
|
|
|
|
2017-06-05 06:44:31 -07:00
|
|
|
template<bool isRequest, class Body, class Fields>
|
2017-06-05 07:20:58 -07:00
|
|
|
template<class OtherBody, class... Args, class>
|
2017-06-05 06:44:31 -07:00
|
|
|
parser<isRequest, Body, Fields>::
|
2017-06-18 14:57:32 -07:00
|
|
|
parser(parser<isRequest, OtherBody, Fields>&& p,
|
2017-06-05 06:44:31 -07:00
|
|
|
Args&&... args)
|
2017-06-18 14:57:32 -07:00
|
|
|
: base_type(std::move(p))
|
|
|
|
|
, m_(p.release(), std::forward<Args>(args)...)
|
2017-06-05 06:44:31 -07:00
|
|
|
{
|
2017-06-18 14:57:32 -07:00
|
|
|
if(p.wr_)
|
2017-06-05 06:44:31 -07:00
|
|
|
BOOST_THROW_EXCEPTION(std::invalid_argument{
|
|
|
|
|
"moved-from parser has a body"});
|
|
|
|
|
}
|
|
|
|
|
|
2016-11-20 07:32:41 -05:00
|
|
|
} // http
|
|
|
|
|
} // beast
|
|
|
|
|
|
|
|
|
|
#endif
|