2016-04-19 20:29:16 -04:00
|
|
|
//
|
|
|
|
|
// Copyright (c) 2013-2016 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)
|
|
|
|
|
//
|
|
|
|
|
|
|
|
|
|
#ifndef BEAST_HTTP_EMPTY_BODY_HPP
|
|
|
|
|
#define BEAST_HTTP_EMPTY_BODY_HPP
|
|
|
|
|
|
2016-05-01 12:33:35 -04:00
|
|
|
#include <beast/http/body_type.hpp>
|
2016-04-19 20:29:16 -04:00
|
|
|
#include <boost/asio/buffer.hpp>
|
|
|
|
|
#include <memory>
|
|
|
|
|
#include <string>
|
|
|
|
|
|
|
|
|
|
namespace beast {
|
|
|
|
|
namespace http {
|
|
|
|
|
|
|
|
|
|
/** An empty content-body.
|
2016-05-01 12:33:35 -04:00
|
|
|
|
|
|
|
|
Meets the requirements of @b `Body`.
|
2016-04-19 20:29:16 -04:00
|
|
|
*/
|
|
|
|
|
struct empty_body
|
|
|
|
|
{
|
2016-04-22 19:02:07 -04:00
|
|
|
#if GENERATING_DOCS
|
|
|
|
|
/// The type of the `message::body` member
|
|
|
|
|
using value_type = void;
|
|
|
|
|
#else
|
|
|
|
|
struct value_type {};
|
|
|
|
|
#endif
|
|
|
|
|
|
|
|
|
|
#if GENERATING_DOCS
|
|
|
|
|
private:
|
|
|
|
|
#endif
|
2016-04-19 20:29:16 -04:00
|
|
|
|
|
|
|
|
struct writer
|
|
|
|
|
{
|
2016-05-01 11:14:10 -04:00
|
|
|
template<bool isRequest, class Headers>
|
2016-04-19 20:29:16 -04:00
|
|
|
explicit
|
2016-10-15 13:40:17 -04:00
|
|
|
writer(message<isRequest, empty_body, Headers> const& m) noexcept
|
2016-04-19 20:29:16 -04:00
|
|
|
{
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
void
|
2016-10-15 13:40:17 -04:00
|
|
|
init(error_code& ec) noexcept
|
2016-04-19 20:29:16 -04:00
|
|
|
{
|
|
|
|
|
}
|
|
|
|
|
|
2016-04-29 06:04:40 -04:00
|
|
|
std::uint64_t
|
2016-10-15 13:40:17 -04:00
|
|
|
content_length() const noexcept
|
2016-04-19 20:29:16 -04:00
|
|
|
{
|
|
|
|
|
return 0;
|
|
|
|
|
}
|
|
|
|
|
|
2016-10-15 13:40:17 -04:00
|
|
|
template<class WriteFunction>
|
2016-04-19 20:29:16 -04:00
|
|
|
boost::tribool
|
2016-10-15 13:40:17 -04:00
|
|
|
write(resume_context&&, error_code&,
|
|
|
|
|
WriteFunction&& wf) noexcept
|
2016-04-19 20:29:16 -04:00
|
|
|
{
|
2016-10-15 13:40:17 -04:00
|
|
|
wf(boost::asio::null_buffers{});
|
2016-04-19 20:29:16 -04:00
|
|
|
return true;
|
|
|
|
|
}
|
|
|
|
|
};
|
|
|
|
|
};
|
|
|
|
|
|
|
|
|
|
} // http
|
|
|
|
|
} // beast
|
|
|
|
|
|
|
|
|
|
#endif
|