Examples |
Definition at line 23 of file reply.hpp.
Public Types | |
enum | status_type { ok = 200, created = 201, accepted = 202, no_content = 204, multiple_choices = 300, moved_permanently = 301, moved_temporarily = 302, not_modified = 304, bad_request = 400, unauthorized = 401, forbidden = 403, not_found = 404, internal_server_error = 500, not_implemented = 501, bad_gateway = 502, service_unavailable = 503 } |
The status of the reply. More... | |
Public Member Functions | |
std::vector< asio::const_buffer > | to_buffers () |
Convert the reply into a vector of buffers. The buffers do not own the underlying memory blocks, therefore the reply object must remain valid and not be changed until the write operation has completed. | |
Static Public Member Functions | |
static reply | stock_reply (status_type status) |
Get a stock reply. | |
Public Attributes | |
enum http::server::reply::status_type | status |
The status of the reply. | |
std::vector< header > | headers |
The headers to be included in the reply. | |
std::string | content |
The content to be sent in the reply. |
The status of the reply.
Definition at line 26 of file reply.hpp.
00027 { 00028 ok = 200, 00029 created = 201, 00030 accepted = 202, 00031 no_content = 204, 00032 multiple_choices = 300, 00033 moved_permanently = 301, 00034 moved_temporarily = 302, 00035 not_modified = 304, 00036 bad_request = 400, 00037 unauthorized = 401, 00038 forbidden = 403, 00039 not_found = 404, 00040 internal_server_error = 500, 00041 not_implemented = 501, 00042 bad_gateway = 502, 00043 service_unavailable = 503 00044 } status;
std::vector< asio::const_buffer > http::server::reply::to_buffers | ( | ) |
Convert the reply into a vector of buffers. The buffers do not own the underlying memory blocks, therefore the reply object must remain valid and not be changed until the write operation has completed.
Definition at line 103 of file reply.cpp.
Referenced by http::server::connection::handle_read().
00104 { 00105 std::vector<asio::const_buffer> buffers; 00106 buffers.push_back(status_strings::to_buffer(status)); 00107 for (std::size_t i = 0; i < headers.size(); ++i) 00108 { 00109 header& h = headers[i]; 00110 buffers.push_back(asio::buffer(h.name)); 00111 buffers.push_back(asio::buffer(misc_strings::name_value_separator)); 00112 buffers.push_back(asio::buffer(h.value)); 00113 buffers.push_back(asio::buffer(misc_strings::crlf)); 00114 } 00115 buffers.push_back(asio::buffer(misc_strings::crlf)); 00116 buffers.push_back(asio::buffer(content)); 00117 return buffers; 00118 }
reply http::server::reply::stock_reply | ( | status_type | status | ) | [static] |
Get a stock reply.
Definition at line 242 of file reply.cpp.
Referenced by http::server::connection::handle_read(), and http::server::request_handler::handle_request().
00243 { 00244 reply rep; 00245 rep.status = status; 00246 rep.content = stock_replies::to_string(status); 00247 rep.headers.resize(2); 00248 rep.headers[0].name = "Content-Length"; 00249 rep.headers[0].value = boost::lexical_cast<std::string>(rep.content.size()); 00250 rep.headers[1].name = "Content-Type"; 00251 rep.headers[1].value = "text/html"; 00252 return rep; 00253 }
The status of the reply.
Referenced by http::server::request_handler::handle_request(), stock_reply(), and to_buffers().
std::vector<header> http::server::reply::headers |
The headers to be included in the reply.
Definition at line 47 of file reply.hpp.
Referenced by http::server::request_handler::handle_request(), stock_reply(), and to_buffers().
std::string http::server::reply::content |
The content to be sent in the reply.
Definition at line 50 of file reply.hpp.
Referenced by http::server::request_handler::handle_request(), stock_reply(), and to_buffers().