2015-01-27 06:35:29 -05:00
|
|
|
#ifndef REPLY_HPP
|
|
|
|
#define REPLY_HPP
|
2011-01-09 16:42:27 -05:00
|
|
|
|
2016-01-02 11:13:44 -05:00
|
|
|
#include "server/http/header.hpp"
|
2011-01-09 16:42:27 -05:00
|
|
|
|
2015-01-27 06:35:29 -05:00
|
|
|
#include <boost/asio.hpp>
|
|
|
|
|
|
|
|
#include <vector>
|
2013-12-16 05:29:38 -05:00
|
|
|
|
2014-05-11 12:03:05 -04:00
|
|
|
namespace http
|
|
|
|
{
|
2015-01-27 06:35:29 -05:00
|
|
|
class reply
|
2014-05-07 10:50:48 -04:00
|
|
|
{
|
2014-05-11 12:03:05 -04:00
|
|
|
public:
|
2015-01-27 06:35:29 -05:00
|
|
|
enum status_type
|
|
|
|
{
|
|
|
|
ok = 200,
|
|
|
|
bad_request = 400,
|
|
|
|
internal_server_error = 500
|
|
|
|
} status;
|
2013-12-13 17:26:57 -05:00
|
|
|
|
2015-01-27 06:35:29 -05:00
|
|
|
std::vector<header> headers;
|
|
|
|
std::vector<boost::asio::const_buffer> to_buffers();
|
|
|
|
std::vector<boost::asio::const_buffer> headers_to_buffers();
|
|
|
|
std::vector<char> content;
|
|
|
|
static reply stock_reply(const status_type status);
|
|
|
|
void set_size(const std::size_t size);
|
|
|
|
void set_uncompressed_size();
|
2013-12-13 17:26:57 -05:00
|
|
|
|
2015-01-27 06:35:29 -05:00
|
|
|
reply();
|
2013-12-13 17:26:57 -05:00
|
|
|
|
2014-05-11 12:03:05 -04:00
|
|
|
private:
|
2015-01-27 06:35:29 -05:00
|
|
|
std::string status_to_string(reply::status_type status);
|
|
|
|
boost::asio::const_buffer status_to_buffer(reply::status_type status);
|
2011-01-09 16:42:27 -05:00
|
|
|
};
|
2015-01-27 06:35:29 -05:00
|
|
|
}
|
2011-01-09 16:42:27 -05:00
|
|
|
|
2015-01-27 06:35:29 -05:00
|
|
|
#endif // REPLY_HPP
|