mirror of
https://github.com/3lswear/webserv.git
synced 2025-10-28 21:07:59 +03:00
68 lines
1.3 KiB
C++
68 lines
1.3 KiB
C++
#ifndef CLIENT_HPP
|
|
# define CLIENT_HPP
|
|
|
|
#include "webserv.hpp"
|
|
#include "Autoindex.hpp"
|
|
#include "ServerConfig.hpp"
|
|
#include "Request.hpp"
|
|
#include "Response.hpp"
|
|
|
|
class Client
|
|
{
|
|
private:
|
|
Request _request;
|
|
Response _response;
|
|
ServerConfig *_config;
|
|
|
|
private:
|
|
int _ret;
|
|
int _fd;
|
|
unsigned int _sended;
|
|
char *_buff;
|
|
|
|
|
|
std::string _bodyToSend;
|
|
std::string _headerToSend;
|
|
std::string _toSend;
|
|
std::map<std::string, std::string> _errorCode;
|
|
|
|
public:
|
|
bool allRead;
|
|
|
|
public:
|
|
Request getRequest(void);
|
|
Response getResponse(void);
|
|
std::string getStrToSend(void);
|
|
unsigned int getCounter(void) const;
|
|
void setRawData(char *);
|
|
void setFd(int);
|
|
int getFd(void);
|
|
unsigned int getRecvCounter(void) const;
|
|
bool isEmpty(void);
|
|
|
|
public:
|
|
int parseRequest(void);
|
|
|
|
void printClientInfo(void);
|
|
|
|
bool readyToSend(void);
|
|
bool allSended(void);
|
|
bool allRecved(void);
|
|
bool isChunked(void);
|
|
int sendResponse(int fd);
|
|
int sendData(int , std::string data);
|
|
void clear(void);
|
|
void increaseCounter(void);
|
|
void increaseRecvCounter(unsigned int n);
|
|
std::string generateRespons(void);
|
|
|
|
Client();
|
|
Client(char *);
|
|
Client(char *, ServerConfig *config);
|
|
~Client();
|
|
|
|
|
|
};
|
|
|
|
#endif
|