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.
34 lines
693 B
34 lines
693 B
#pragma once
|
|
#include "webserv.hpp"
|
|
|
|
class Socket {
|
|
int _fd;
|
|
//int _clients_amount;
|
|
Socket *_parent;
|
|
std::vector<Socket *> _childs;
|
|
struct sockaddr_in _address;
|
|
string _header;
|
|
string _content;
|
|
std::map<string,std::vector<string> > _request;
|
|
|
|
bool getRequest(string paquet);
|
|
bool parseHeader();
|
|
int answer(Env *env);
|
|
void send_answer(string msg);
|
|
bool waitHeader();
|
|
Server *choose_server(Env *env, string host);
|
|
public:
|
|
Socket(listen_t listen);
|
|
Socket(int fd, Socket *parent);
|
|
~Socket(void);
|
|
|
|
listen_t _listen;
|
|
static fd_set _readfds;
|
|
static int _max_fd;
|
|
static int _min_fd;
|
|
static int _amount;
|
|
|
|
int launch(void);
|
|
void set_fds(void);
|
|
void refresh(Env *env);
|
|
};
|
|
|