41 lines
833 B
C++
41 lines
833 B
C++
/*********************************/
|
|
/* */
|
|
/* o.riabenkyi@gmail.com */
|
|
/* */
|
|
/*********************************/
|
|
|
|
#ifndef REQUEST_HPP
|
|
#define REQUEST_HPP
|
|
|
|
#include <optional>
|
|
#include <string>
|
|
#include <string_view>
|
|
#include <utility>
|
|
#include <vector>
|
|
|
|
namespace webserv {
|
|
|
|
enum class Method { Get, Post, Delete };
|
|
|
|
const char* toString(Method method) noexcept;
|
|
|
|
bool headerNameEquals(std::string_view a, std::string_view b) noexcept;
|
|
|
|
enum class HttpVersion { Http10, Http11 };
|
|
|
|
struct Request {
|
|
Method method;
|
|
std::string target;
|
|
HttpVersion version;
|
|
|
|
std::vector<std::pair<std::string, std::string>> headers;
|
|
std::vector<char> body;
|
|
|
|
std::optional<std::string_view> header(std::string_view name) const noexcept;
|
|
};
|
|
|
|
}
|
|
|
|
#endif
|
|
|