-
Notifications
You must be signed in to change notification settings - Fork 0
/
Response.hpp
67 lines (61 loc) · 2.33 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
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
/* ************************************************************************** */
/* */
/* ::: :::::::: */
/* Response.hpp :+: :+: :+: */
/* +:+ +:+ +:+ */
/* By: eej-jama <[email protected]> +#+ +:+ +#+ */
/* +#+#+#+#+#+ +#+ */
/* Created: 2024/01/25 19:34:24 by hlakhal- #+# #+# */
/* Updated: 2024/02/04 19:54:25 by eej-jama ### ########.fr */
/* */
/* ************************************************************************** */
#ifndef RESPONSE_HPP
#define RESPONSE_HPP
#include <iostream>
#include <fstream>
#include <vector>
#include <cstdlib>
#include <cstring>
#include <unistd.h>
#include <csignal>
#include <sstream>
#include <fcntl.h>
#include <sys/socket.h>
#include <map>
class Response
{
private:
bool status;
int fd;
int status_code;
bool status_close;
bool isCgi;
std::string header;
std::string body;
std::string path;
std::string type;
std::ifstream file;
bool status_header;
std::map<int, std::string> HttpStatusMessages;
public:
Response();
Response(bool status,int fd, int status_code, std::string path);
Response& operator=(const Response& other);
Response(const Response& other);
void setValues(bool status,int fd, int status_code, std::string path, std::string type,std::string content, bool isCgi);
void closeFile();
bool getStatusResponse() const;
void setStatusHeader(bool status_header);
bool getStatusHeader() const;
bool getStatusClinet() const;
bool getStatustCgi() const;
std::string getHeader();
std::ifstream& getFile() ;
int getStatusCode() const;
std::string getBody();
const std::string& getPathFile();
void openFile(const std::string& path);
const std::map<int, std::string>& getHttpStatusMessages() const;
~Response();
};
#endif