-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathrequest_processor.hpp
More file actions
61 lines (46 loc) · 1.4 KB
/
request_processor.hpp
File metadata and controls
61 lines (46 loc) · 1.4 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
#ifndef FB_HTTP_REQUEST_PROCESSOR_LIBRARY__
#define FB_HTTP_REQUEST_PROCESSOR_LIBRARY__
#include <sstream>
#include <unordered_map>
#include <vector>
#include <stdexcept>
#include <cstdio>
#include <event.h>
#include <evhttp.h>
#include <interfaces/guest.hpp>
#include <macros/scope_guard.hpp>
#include <macros/repeat_until.hpp>
#include "internal_request.hpp"
#include "utility/string.hpp"
#include "utility/nullcoalesce.hpp"
#include "stream/memory_file.hpp"
#include "error.hpp"
namespace nt { namespace http {
using nt::http::interfaces::Guest;
class InternalRequest;
class RequestProcessor :
public Guest<InternalRequest>
{
public:
std::string method;
std::unordered_map<std::string, std::string> headers;
std::unordered_map<std::string, std::string> post_data;
std::unordered_map<std::string, std::string> query_data;
std::unordered_map<std::string, std::string> cookies;
std::unordered_map<std::string, nt::interfaces::File> files;
private:
evhttp_request* request;
public:
RequestProcessor();
~RequestProcessor() = default;
void visit(InternalRequest* host);
protected:
void parse(evhttp_request*);
void parse_method();
void parse_uri();
void parse_headers();
void parse_post_data();
void parse_files();
};
}}
#endif /* FB_HTTP_REQUEST_PROCESSOR_LIBRARY__ */