#include <Connection.hpp>
Definition at line 33 of file Connection.hpp.
◆ Connection() [1/3]
| Connection::Connection |
( |
| ) |
|
◆ Connection() [2/3]
| Connection::Connection |
( |
int |
fd, |
|
|
const struct sockaddr_in & |
ipa, |
|
|
const ServerConf * |
defaultConfig |
|
) |
| |
◆ Connection() [3/3]
| Connection::Connection |
( |
const Connection & |
other | ) |
|
◆ ~Connection()
| Connection::~Connection |
( |
| ) |
|
◆ operator=()
◆ handleRead()
| void Connection::handleRead |
( |
| ) |
|
Reads data from the client socket using recv() into _readBuffer. Transitions state to PROCESSING if the request is fully received.
Definition at line 180 of file Connection.cpp.
◆ process()
| void Connection::process |
( |
| ) |
|
Executes routing logic, instantiates the Response, and prepares data for sending. Transitions state to WRITING or handles CGI setup based on LocationConf.
Definition at line 210 of file Connection.cpp.
◆ handleWrite()
| void Connection::handleWrite |
( |
| ) |
|
Writes data from the _writeBuffer (or Response) to the client socket using send(). Transitions state to FINISHED when the transaction is completely sent.
Definition at line 268 of file Connection.cpp.
◆ hasTimedOut()
| bool Connection::hasTimedOut |
( |
int |
timeoutSeconds | ) |
const |
Checks if the connection has exceeded the defined timeout threshold.
- Parameters
-
| timeoutSeconds | The maximum allowed idle time in seconds. |
- Returns
- true if timed out, false otherwise.
Definition at line 279 of file Connection.cpp.
◆ triggerError()
| void Connection::triggerError |
( |
int |
statusCode | ) |
|
Forces the connection into an error state, bypassing normal processing.
- Parameters
-
| statusCode | The HTTP status code to generate (e.g., 400, 408, 500). |
Definition at line 284 of file Connection.cpp.
◆ getFd()
| int Connection::getFd |
( |
| ) |
const |
◆ getState()
◆ setState()
◆ getResponse()
| Response * Connection::getResponse |
( |
| ) |
const |
◆ getRequest()
| Request * Connection::getRequest |
( |
| ) |
const |
◆ getServerConf()
| const ServerConf * Connection::getServerConf |
( |
| ) |
const |
◆ getCgiPipeFd()
| int Connection::getCgiPipeFd |
( |
| ) |
const |
Returns the CGI output pipe fd, or -1 if no CGI is active.
Definition at line 107 of file Connection.cpp.
◆ setLocationConf()
| void Connection::setLocationConf |
( |
const LocationConf * |
conf | ) |
|
Assigns the appropriate location block after parsing the request URI.
- Parameters
-
| conf | The correctly matched location configuration. |
Definition at line 105 of file Connection.cpp.
◆ _updateActivityTimer()
| void Connection::_updateActivityTimer |
( |
| ) |
|
|
private |
Updates the _lastActivity timestamp to current time.
Definition at line 114 of file Connection.cpp.
◆ _readHeaders()
| void Connection::_readHeaders |
( |
const char * |
buf, |
|
|
size_t |
n |
|
) |
| |
|
private |
◆ _readBody()
| void Connection::_readBody |
( |
const char * |
buf, |
|
|
size_t |
n |
|
) |
| |
|
private |
◆ _readChunked()
| void Connection::_readChunked |
( |
const char * |
buf, |
|
|
size_t |
n |
|
) |
| |
|
private |
◆ _acceptFD
| int Connection::_acceptFD |
|
private |
◆ _IPA
| struct sockaddr_in Connection::_IPA |
|
private |
◆ _lastActivity
| time_t Connection::_lastActivity |
|
private |
◆ _serverConf
◆ _locationConf
◆ _readBufferSize
| size_t Connection::_readBufferSize |
|
private |
◆ _readBuffer
| std::string Connection::_readBuffer |
|
private |
◆ _request
◆ _response
◆ _writeBufferSize
| size_t Connection::_writeBufferSize |
|
private |
◆ _writeBuffer
| std::string Connection::_writeBuffer |
|
private |
◆ _state
◆ _totalBytesRead
| size_t Connection::_totalBytesRead |
|
private |
The documentation for this class was generated from the following files: