HTTP response. More...
Classes | |
struct | static_file_info |
This constains metadata (coming from the stat command) related to any static files associated with this response. More... | |
Public Member Functions | |
void | set_header (std::string key, std::string value) |
Set the value of an existing header in the response. More... | |
void | add_header (std::string key, std::string value) |
Add a new header to the response. More... | |
const std::string & | get_header_value (const std::string &key) |
response () | |
response (int code) | |
response (std::string body) | |
response (int code, std::string body) | |
response (returnable &&value) | |
response (returnable &value) | |
response (int code, returnable &value) | |
response (response &&r) | |
response (std::string contentType, std::string body) | |
response (int code, std::string contentType, std::string body) | |
response & | operator= (const response &r)=delete |
response & | operator= (response &&r) noexcept |
bool | is_completed () const noexcept |
Check if the response has completed (whether response.end() has been called) More... | |
void | clear () |
void | redirect (const std::string &location) |
Return a "Temporary Redirect" response. More... | |
void | redirect_perm (const std::string &location) |
Return a "Permanent Redirect" response. More... | |
void | moved (const std::string &location) |
Return a "Found (Moved Temporarily)" response. More... | |
void | moved_perm (const std::string &location) |
Return a "Moved Permanently" response. More... | |
void | write (const std::string &body_part) |
void | end () |
Set the response completion flag and call the handler (to send the response). More... | |
void | end (const std::string &body_part) |
Same as end() except it adds a body part right before ending. More... | |
bool | is_alive () |
Check if the connection is still alive (usually by checking the socket status). More... | |
bool | is_static_type () |
Check whether the response has a static file defined. More... | |
void | set_static_file_info (std::string path) |
Return a static file as the response body. More... | |
void | set_static_file_info_unsafe (std::string path) |
Return a static file as the response body without sanitizing the path (use set_static_file_info instead) More... | |
Public Attributes | |
int | code {200} |
The Status code for the response. More... | |
std::string | body |
The actual payload containing the response data. More... | |
ci_map | headers |
HTTP headers. More... | |
bool | skip_body = false |
Whether this is a response to a HEAD request. More... | |
bool | manual_length_header = false |
Whether Crow should automatically add a "Content-Length" header. More... | |
Private Attributes | |
bool | completed_ {} |
std::function< void()> | complete_request_handler_ |
std::function< bool()> | is_alive_helper_ |
static_file_info | file_info |
Friends | |
template<typename Adaptor , typename Handler , typename... Middlewares> | |
class | crow::Connection |
template<typename F , typename App , typename... Middlewares> | |
struct | crow::detail::handler_middleware_wrapper |
HTTP response.
|
inline |
|
inlineexplicit |
|
inline |
|
inline |
|
inline |
|
inline |
|
inline |
|
inline |
|
inline |
|
inline |
|
inline |
Set the value of an existing header in the response.
|
inline |
Add a new header to the response.
|
inline |
|
inlinenoexcept |
Check if the response has completed (whether response.end() has been called)
|
inline |
|
inline |
Return a "Temporary Redirect" response.
Location can either be a route or a full URL.
|
inline |
Return a "Permanent Redirect" response.
Location can either be a route or a full URL.
|
inline |
Return a "Found (Moved Temporarily)" response.
Location can either be a route or a full URL.
|
inline |
Return a "Moved Permanently" response.
Location can either be a route or a full URL.
|
inline |
|
inline |
Set the response completion flag and call the handler (to send the response).
|
inline |
Same as end() except it adds a body part right before ending.
|
inline |
Check if the connection is still alive (usually by checking the socket status).
|
inline |
Check whether the response has a static file defined.
|
inline |
Return a static file as the response body.
|
inline |
Return a static file as the response body without sanitizing the path (use set_static_file_info instead)
|
friend |
|
friend |
int crow::response::code {200} |
The Status code for the response.
std::string crow::response::body |
The actual payload containing the response data.
ci_map crow::response::headers |
HTTP headers.
bool crow::response::skip_body = false |
Whether this is a response to a HEAD request.
bool crow::response::manual_length_header = false |
Whether Crow should automatically add a "Content-Length" header.
|
private |
|
private |
|
private |
|
private |