8#define MAX_HEADER_SIZE 8192
12#include <netinet/in.h>
128 void _readBody(
const char* buf,
size_t n);
ConnectionState
Represents the state of the CLIENT SOCKET.
Stores per-route configuration directives. This class encapsulates the configuration for a specific l...
Parses and stores the entire HTTP request entity (headers, body). Utilizes a State Machine to handle ...
Formulates the HTTP response and manages non-blocking data transmission.
Stores per-server configuration directives. This class encapsulates the configuration for a specific ...
void handleWrite()
Writes data from the _writeBuffer (or Response) to the client socket using send()....
void setLocationConf(const LocationConf *conf)
Assigns the appropriate location block after parsing the request URI.
ConnectionState getState() const
Connection & operator=(const Connection &other)
Response * getResponse() const
const ServerConf * _serverConf
bool hasTimedOut(int timeoutSeconds) const
Checks if the connection has exceeded the defined timeout threshold.
void setState(ConnectionState state)
Request * getRequest() const
void process()
Executes routing logic, instantiates the Response, and prepares data for sending. Transitions state t...
void _updateActivityTimer()
Updates the _lastActivity timestamp to current time.
const LocationConf * _locationConf
void triggerError(int statusCode)
Forces the connection into an error state, bypassing normal processing.
const ServerConf * getServerConf() const
void _readChunked(const char *buf, size_t n)
int getCgiPipeFd() const
Returns the CGI output pipe fd, or -1 if no CGI is active.
void _readHeaders(const char *buf, size_t n)
void handleRead()
Reads data from the client socket using recv() into _readBuffer. Transitions state to PROCESSING if t...
void _readBody(const char *buf, size_t n)