2018-11-01 12:47:14 +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
|
|
|
|
{
|
2018-11-22 23:59:03 +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
|