You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

38 lines
904 B

2 years ago
#pragma once
#include "webserv.hpp"
class Client {
2 years ago
int _fd;
ip_port_t _ip_port;
Master *_parent;
Server *_server;
Env *_env;
Route *_route;
string _method, _uri, _query, _host, _header, _body;
int _len;
bool _last_chunk;
std::map<string, vec_string> _request;
2 years ago
2 years ago
void init(void);
bool getBody(string paquet);
bool parseHeader(Env *env);
string header_pick(string key, size_t id);
2 years ago
bool check_method(void);
void create_file(string path);
void cgi(string cgi_path, string path);
void send_error(int error_code, string opt = "");
2 years ago
void send_answer(string msg);
2 years ago
2 years ago
#ifdef DEBUG
void debug_header(void);
#endif
2 years ago
2 years ago
public:
2 years ago
Client(int fd, ip_port_t ip_port, Master *parent);
~Client(void);
2 years ago
bool getRequest(Env *env, string paquet);
void handleRequest(void);
2 years ago
2 years ago
friend class Master;
};