forked from MT-jlem/webserv
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathresponse.hpp
51 lines (47 loc) · 1.3 KB
/
response.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
#ifndef RESPONSE_HPP
#define RESPONSE_HPP
#include <iterator>
#include <string>
#include <map>
#include <sys/_types/_size_t.h>
#include <vector>
#include "request.hpp"
#include "server.hpp"
class Response {
private:
std::map<std::string, std::string> headers;
std::string body;
int locIndex;
std::string path;
std::string file;
std::vector<std::string> data;
size_t pos;
std::string ext;
char *cgiEnv[11];
bool errorHandled;
public:
std::string res;
Response();
Response(request &req, Server &serv);
~Response();
void getM(Server &serv, request &req);
void postM(Server &serv, request &req);
void deleteM();
void resBuilder(request &req, Server &serv);
void errorRes(Server &serv, request &req);
std::string getResLine(request &req, Server &serv);
std::string getHeaders();
std::string getBody(const std::string &path, Server &serv, request &req);
std::string getDate();
std::string getContentLength();
std::string getContentType();
std::string getPath(request &req, Server &serv);
std::string getFile(Server &serv);
std::string generateDirHtml(std::string path, request &req);
std::string generateErrHtml();
int getLocation(request &req, Server &serv);
void reDirRes(Server &serv, request &req);
std::string execCgi(Server &serv, request &req);
void initializeEnv(request &req);
};
#endif