45 lines
899 B
C++
45 lines
899 B
C++
#ifndef HTTP_REQUEST_HPP
|
|
#define HTTP_REQUEST_HPP
|
|
|
|
#include <string>
|
|
#include <vector>
|
|
#include <map>
|
|
#include "header.hpp"
|
|
|
|
|
|
namespace http::server {
|
|
class Url {
|
|
public:
|
|
explicit Url(const std::string& url);
|
|
|
|
std::string path;
|
|
std::map<std::string, std::string> params;
|
|
|
|
~Url();
|
|
};
|
|
|
|
/// A request received from a client.
|
|
class Request {
|
|
public:
|
|
Request(bool secure);
|
|
|
|
void reset();
|
|
std::string getHeaderValue(const std::string& headerName) const;
|
|
|
|
std::string method;
|
|
std::string queryUri;
|
|
std::unique_ptr<Url> url;
|
|
bool isKeepAlive{};
|
|
const bool isSecure;
|
|
int httpVersionMajor{};
|
|
int httpVersionMinor{};
|
|
std::vector<header> headers;
|
|
std::vector<char> payload;
|
|
|
|
~Request();
|
|
};
|
|
} // namespace http::Server
|
|
|
|
|
|
#endif // HTTP_REQUEST_HPP
|