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.

39 lines
866 B

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