2019-04-24 23:27:31 +00:00
|
|
|
#ifndef ABYSS_HTTP_HPP
|
|
|
|
#define ABYSS_HTTP_HPP
|
2019-02-15 23:04:04 +00:00
|
|
|
#include <util/json.hpp>
|
2019-01-10 19:41:51 +00:00
|
|
|
#include <util/string_view.hpp>
|
2018-12-12 02:52:51 +00:00
|
|
|
|
2018-11-01 12:47:14 +00:00
|
|
|
#include <string>
|
|
|
|
#include <unordered_map>
|
|
|
|
|
|
|
|
namespace abyss
|
|
|
|
{
|
|
|
|
namespace http
|
|
|
|
{
|
|
|
|
struct RequestHeader
|
|
|
|
{
|
2020-04-07 18:38:56 +00:00
|
|
|
using Headers_t = std::unordered_multimap<std::string, std::string>;
|
2018-11-01 12:47:14 +00:00
|
|
|
Headers_t Headers;
|
|
|
|
std::string Method;
|
|
|
|
std::string Path;
|
|
|
|
};
|
|
|
|
|
|
|
|
struct HeaderReader
|
|
|
|
{
|
2019-02-15 23:04:04 +00:00
|
|
|
using string_view = llarp::string_view;
|
|
|
|
|
2018-11-01 12:47:14 +00:00
|
|
|
RequestHeader Header;
|
|
|
|
virtual ~HeaderReader()
|
|
|
|
{
|
|
|
|
}
|
|
|
|
|
|
|
|
bool
|
2019-02-15 23:04:04 +00:00
|
|
|
ProcessHeaderLine(string_view line, bool& done);
|
2018-11-01 12:47:14 +00:00
|
|
|
|
|
|
|
virtual bool
|
2019-02-15 23:04:04 +00:00
|
|
|
ShouldProcessHeader(const string_view& line) const = 0;
|
2018-11-01 12:47:14 +00:00
|
|
|
};
|
|
|
|
|
|
|
|
} // namespace http
|
|
|
|
} // namespace abyss
|
2018-11-22 23:59:03 +00:00
|
|
|
#endif
|