-
Notifications
You must be signed in to change notification settings - Fork 1
/
Copy pathRes.hpp
59 lines (44 loc) · 1.04 KB
/
Res.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
50
51
52
53
54
55
56
57
58
59
#pragma once
/* C headers*/
#include <stdint.h>
#include <unistd.h>
#include <cstdlib>
#include <sys/wait.h>
/* C++ headers*/
#include <iostream>
#include <algorithm>
#include <cstring>
/* Classes */
#include <Req.hpp>
#include <HttpError.hpp>
#include <ConnStream.hpp>
/*Utils*/
#include <__webserv_utils.hpp>
class ConnStream;
class Res
{
private:
ConnStream *stream;
/* Status */
std::map<std::string, std::string> status;
std::map<std::string, std::string> content_type;
int is_redirection(void);
int check_method(void);
std::string check_index(void);
int check_dir_listing(void);
int exec_CGI(void);
int exec_get(void);
int exec_post(void);
void exec_delete(void);
int build_http_response(void);
std::string set_file_ext(std::string name);
public:
std::string status_code;
std::string error_msg;
std::string content; // * What is going to get rendered
std::string data; // * Final Result in case it is not the CGI
std::string c_type_response;
Res(ConnStream *);
~Res();
int send(void);
};