Webserv
Loading...
Searching...
No Matches
Client.hpp
Go to the documentation of this file.
1#pragma once
2#include "webserv.hpp"
3
4class Client {
5 int _fd;
12 int _len;
14 std::map<string, vec_string> _request;
15
16 void init(void);
17 bool getBody(string paquet);
18 bool parseHeader(Env *env);
19 string header_pick(string key, size_t id);
20 bool check_method(void);
21 void create_file(string path);
22 void cgi(string cgi_path, string path);
23 void send_redir(int redir_code, string opt);
24 void send_error(int error_code);
25 void send_answer(string msg);
26
27#ifdef DEBUG
28 void debug_header(void);
29#endif
30
31public:
32 Client(int fd, ip_port_t ip_port, Master *parent);
33 ~Client(void);
34 bool getRequest(Env *env, string paquet);
35 void handleRequest(void);
36
37 friend class Master;
38};
Definition: Client.hpp:4
void create_file(string path)
Definition: Client.cpp:167
void send_redir(int redir_code, string opt)
Definition: Client.cpp:212
void debug_header(void)
Definition: debug.cpp:11
string _body
Definition: Client.hpp:11
string _host
Definition: Client.hpp:11
int _len
Definition: Client.hpp:12
bool parseHeader(Env *env)
Definition: Client.cpp:79
Env * _env
Definition: Client.hpp:9
void send_answer(string msg)
Definition: Client.cpp:236
Server * _server
Definition: Client.hpp:8
std::map< string, vec_string > _request
Definition: Client.hpp:14
void init(void)
Definition: Client.cpp:28
string _method
Definition: Client.hpp:11
Route * _route
Definition: Client.hpp:10
Master * _parent
Definition: Client.hpp:7
~Client(void)
Definition: Client.cpp:23
bool check_method(void)
Definition: Client.cpp:123
int _fd
Definition: Client.hpp:5
string _query
Definition: Client.hpp:11
string _uri
Definition: Client.hpp:11
ip_port_t _ip_port
Definition: Client.hpp:6
bool getBody(string paquet)
Definition: Client.cpp:58
void cgi(string cgi_path, string path)
Definition: Client.cpp:178
void handleRequest(void)
Definition: Client.cpp:133
string header_pick(string key, size_t id)
Definition: Client.cpp:121
string _header
Definition: Client.hpp:11
void send_error(int error_code)
Definition: Client.cpp:219
bool getRequest(Env *env, string paquet)
Definition: Client.cpp:37
bool _last_chunk
Definition: Client.hpp:13
Definition: Env.hpp:4
Definition: Master.hpp:4
Definition: Route.hpp:4
Definition: Server.hpp:4