implement get_parameter to Request.

This commit is contained in:
Relintai 2021-08-05 18:24:55 +02:00
parent 2585468c33
commit b55cb85855
4 changed files with 14 additions and 2 deletions

View File

@ -18,6 +18,10 @@ HTTPMethod Request::get_method() const {
return HTTP_METHOD_GET; return HTTP_METHOD_GET;
} }
const std::string &Request::get_parameter(const std::string &key) const {
return "";
}
void Request::compile_body() { void Request::compile_body() {
compiled_body.reserve(body.size() + head.size() + 13 + 14 + 15); compiled_body.reserve(body.size() + head.size() + 13 + 14 + 15);

View File

@ -1,9 +1,9 @@
#ifndef REQUEST_H #ifndef REQUEST_H
#define REQUEST_H #define REQUEST_H
#include <map>
#include <mutex> #include <mutex>
#include <vector> #include <vector>
#include <map>
#include "core/object.h" #include "core/object.h"
@ -37,7 +37,7 @@ public:
bool connection_closed; bool connection_closed;
HTTPSession *session; HTTPSession *session;
std::map<std::string, Object*> data; std::map<std::string, Object *> data;
virtual const std::string &get_cookie(const std::string &key); virtual const std::string &get_cookie(const std::string &key);
virtual void add_cookie(const ::Cookie &cookie); virtual void add_cookie(const ::Cookie &cookie);
@ -45,6 +45,8 @@ public:
virtual HTTPMethod get_method() const; virtual HTTPMethod get_method() const;
virtual const std::string &get_parameter(const std::string &key) const;
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();

View File

@ -20,6 +20,10 @@ HTTPMethod DRequest::get_method() const {
return static_cast<HTTPMethod>(static_cast<int>(request->getMethod())); return static_cast<HTTPMethod>(static_cast<int>(request->getMethod()));
} }
const std::string &DRequest::get_parameter(const std::string &key) const {
return request->getParameter(key);
}
void DRequest::send() { void DRequest::send() {
//if (connection_closed) { //if (connection_closed) {
// DRequestPool::return_request(this); // DRequestPool::return_request(this);

View File

@ -26,6 +26,8 @@ public:
HTTPMethod get_method() const; HTTPMethod get_method() const;
const std::string &get_parameter(const std::string &key) const;
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();