-
Notifications
You must be signed in to change notification settings - Fork 1
/
Copy pathRequest.hpp
49 lines (35 loc) · 1.06 KB
/
Request.hpp
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
#pragma once
#include <sys/_types/_size_t.h>
#include "socket_header.hpp"
#include "tools.hpp"
#include <functional>
#include <string>
#include <string_view>
#include <unordered_map>
#include <vector>
using namespace tools;
typedef std::unordered_multimap<std::string, std::string> multimap;
typedef multimap::const_iterator const_multi_iter;
// typedef multimap::iterator multi_iter;
class HttpRequest {
private:
std::string _raw;
std::string _method;
std::string _location;
std::string _version;
multimap _headers;
std::string _body;
bool _error;
public:
explicit HttpRequest(const std::string& request);
const std::string& getMethod() const;
const std::string& getLocation() const;
const std::string& getVersion() const;
std::string getHeaderValue(const std::string& key) const;
std::pair<const_multi_iter, const_multi_iter> getHeaderValues(
const std::string& key) const;
const std::string& getBody() const;
const std::string& getRawData() const;
bool error() const;
void dump() const;
};