#include "client.h"

FoClient::FoClient( SOCKET socket , FoWebServer *srv ) {

	sock = socket;
	server = srv;
	server->GrabMutex();
	server->num_of_clients++;
	server->ReleaseMutex();
}


BOOL FoClient::HandleRequest( FoWebRequest &req ) {
	webreq.SetDefaultResponseHeaders();
	webreq.response_string = "<html><body><h1>MEG-BASZ-LAK!!!!</h1></body></html>";
	// usleep( 5000000 );
}

BOOL FoClient::HandleClient( ) {
	webreq.GetRequest( sock );
	HandleRequest( webreq );
	webreq.PutResponse( sock );
	FSSOCKET_Close( sock , NULL );
	server->GrabMutex();
	server->num_of_clients--;
	server->ReleaseMutex();
	
}
