-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathrequest.h
34 lines (28 loc) · 823 Bytes
/
request.h
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
#pragma once
#include <string>
#include <vector>
#include <memory>
typedef std::vector<std::pair<std::string,std::string>> Header_Fields;
class Request
{
public:
// create request object using request string
Request(std::string req);
// function to handle the creation and parsing
static std::unique_ptr<Request> request_handler(std::string raw_req);
std::string getReqRaw() const;
// get methods
std::string method() const;
std::string uri_path() const;
std::string http_version() const;
std::string body() const;
private:
bool parse_request();
bool check_first_request_line(std::string req_line);
std::string req_;
std::string method_;
std::string uri_path_;
std::string http_version_;
std::string body_;
Header_Fields header_fields_;
};