mirror of
https://github.com/3lswear/webserv.git
synced 2025-10-29 13:27:59 +03:00
Merge remote-tracking branch 'origin/fara' into test-client-handle
This commit is contained in:
@@ -4,27 +4,28 @@
|
|||||||
|
|
||||||
Client::Client()
|
Client::Client()
|
||||||
{
|
{
|
||||||
DBOUT << "Client constructor " << this << ENDL;
|
|
||||||
allRead = false;
|
allRead = false;
|
||||||
done = false;
|
done = false;
|
||||||
this->_fd = -1;
|
this->_fd = -1;
|
||||||
this->_sended = 0;
|
this->_sended = 0;
|
||||||
|
_to_send_char = NULL;
|
||||||
}
|
}
|
||||||
|
|
||||||
Client::Client(char *str)
|
Client::Client(char *str)
|
||||||
{
|
{
|
||||||
DBOUT << "Client constructor " << this << ENDL;
|
|
||||||
allRead = false;
|
allRead = false;
|
||||||
done = false;
|
done = false;
|
||||||
this->_fd = -1;
|
this->_fd = -1;
|
||||||
this->_buff = str;
|
this->_buff = str;
|
||||||
this->_sended = 0;
|
this->_sended = 0;
|
||||||
|
_to_send_char = NULL;
|
||||||
|
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
Client::Client(char *str, ServerConfig *config)
|
Client::Client(char *str, ServerConfig *config)
|
||||||
{
|
{
|
||||||
DBOUT << "Client constructor " << this << ENDL;
|
_to_send_char = NULL;
|
||||||
allRead = false;
|
allRead = false;
|
||||||
done = false;
|
done = false;
|
||||||
this->_fd = -1;
|
this->_fd = -1;
|
||||||
@@ -237,10 +238,11 @@ void Client::clear(void)
|
|||||||
_bodyToSend = "";
|
_bodyToSend = "";
|
||||||
_headerToSend = "";
|
_headerToSend = "";
|
||||||
_toSend = "";
|
_toSend = "";
|
||||||
free(_to_send_char);
|
if (_to_send_char)
|
||||||
|
free(_to_send_char);
|
||||||
}
|
}
|
||||||
|
|
||||||
Client::~Client()
|
Client::~Client()
|
||||||
{
|
{
|
||||||
DBOUT << "client destructor called " << this << ENDL;
|
DBOUT << "client destructor called" << ENDL;
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -87,7 +87,7 @@ void Server::readSocket(Client &client, int fd)
|
|||||||
|
|
||||||
int status;
|
int status;
|
||||||
int bytes_read;
|
int bytes_read;
|
||||||
char buf[BUFFSIZE + 1] = {0};
|
char buf[BUFFSIZE + 1];
|
||||||
|
|
||||||
DBOUT << TURQ << "IN readSocket" << RESET << std::endl;
|
DBOUT << TURQ << "IN readSocket" << RESET << std::endl;
|
||||||
DBOUT << "client in readSocket "<< &client << ENDL;
|
DBOUT << "client in readSocket "<< &client << ENDL;
|
||||||
@@ -97,6 +97,7 @@ void Server::readSocket(Client &client, int fd)
|
|||||||
client.allRead = true;
|
client.allRead = true;
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
buf[bytes_read + 1] = '\0';
|
||||||
client.setRawData(buf);
|
client.setRawData(buf);
|
||||||
client.increaseRecvCounter(bytes_read);
|
client.increaseRecvCounter(bytes_read);
|
||||||
status = client.parseRequest();
|
status = client.parseRequest();
|
||||||
|
|||||||
Reference in New Issue
Block a user