mirror of
https://github.com/Relintai/rcpp_framework.git
synced 2025-05-06 17:51:36 +02:00
Implement redirects.
This commit is contained in:
parent
001c3ee717
commit
8e4bb75bcb
@ -37,6 +37,9 @@ const std::string &Request::get_parameter(const std::string &key) const {
|
|||||||
return str;
|
return str;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void Request::send_redirect(const std::string &location, const HTTPStatusCode status_code) {
|
||||||
|
}
|
||||||
|
|
||||||
void Request::compile_body() {
|
void Request::compile_body() {
|
||||||
compiled_body.reserve(body.size() + head.size() + 15 + 13 + 14 + 15);
|
compiled_body.reserve(body.size() + head.size() + 15 + 13 + 14 + 15);
|
||||||
|
|
||||||
|
@ -51,6 +51,7 @@ public:
|
|||||||
|
|
||||||
virtual const std::string &get_parameter(const std::string &key) const;
|
virtual const std::string &get_parameter(const std::string &key) const;
|
||||||
|
|
||||||
|
virtual void send_redirect(const std::string &location, const HTTPStatusCode status_code = HTTP_STATUS_CODE_302_FOUND);
|
||||||
virtual void compile_body();
|
virtual void compile_body();
|
||||||
virtual void compile_and_send_body();
|
virtual void compile_and_send_body();
|
||||||
virtual void next_stage();
|
virtual void next_stage();
|
||||||
|
@ -24,6 +24,19 @@ const std::string &DRequest::get_parameter(const std::string &key) const {
|
|||||||
return request->getParameter(key);
|
return request->getParameter(key);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void DRequest::send_redirect(const std::string &location, const HTTPStatusCode status_code) {
|
||||||
|
drogon::HttpResponsePtr response = drogon::HttpResponse::newRedirectionResponse(location, static_cast<const HttpStatusCode>(static_cast<const int>(status_code)));
|
||||||
|
|
||||||
|
_response_additional_setup(response);
|
||||||
|
|
||||||
|
response->setBody(body);
|
||||||
|
|
||||||
|
response->setExpiredTime(0);
|
||||||
|
callback(response);
|
||||||
|
|
||||||
|
pool();
|
||||||
|
}
|
||||||
|
|
||||||
void DRequest::send() {
|
void DRequest::send() {
|
||||||
//if (connection_closed) {
|
//if (connection_closed) {
|
||||||
// DRequestPool::return_request(this);
|
// DRequestPool::return_request(this);
|
||||||
|
@ -28,6 +28,7 @@ public:
|
|||||||
|
|
||||||
const std::string &get_parameter(const std::string &key) const;
|
const std::string &get_parameter(const std::string &key) const;
|
||||||
|
|
||||||
|
void send_redirect(const std::string &location, const HTTPStatusCode status_code = HTTP_STATUS_CODE_302_FOUND);
|
||||||
void send();
|
void send();
|
||||||
void send_file(const std::string &p_file_path);
|
void send_file(const std::string &p_file_path);
|
||||||
void reset();
|
void reset();
|
||||||
|
Loading…
Reference in New Issue
Block a user