#include <Request.hpp>
Definition at line 35 of file Request.hpp.
◆ Request() [1/3]
◆ Request() [2/3]
| Request::Request |
( |
long long |
_maxBodySize | ) |
|
◆ Request() [3/3]
| Request::Request |
( |
const Request & |
other | ) |
|
◆ ~Request()
◆ operator=()
◆ parseHeaders()
| size_t Request::parseHeaders |
( |
const std::string & |
rawBuffer | ) |
|
Parses the raw buffer containing the HTTP Request-Line and Headers. Transitions state to REQ_BODY, REQ_CHUNKED, or REQ_DONE upon finding "\r\n\r\n".
- Parameters
-
| rawBuffer | The string buffer accumulated by the Connection. |
- Returns
- size_t The index at which the headers end (after "\r\n\r\n"). Useful for slicing leftover body data that recv() accidentally grabbed.
Definition at line 168 of file Request.cpp.
◆ isChunkedDone()
| bool Request::isChunkedDone |
( |
const std::string & |
newData | ) |
const |
Checks if the incoming chunked data contains the terminal "\r\n\r\n". Used to transition from REQ_CHUNKED to REQ_DONE.
- Parameters
-
| newData | The latest chunk of data received from the socket. |
- Returns
- true if the terminal chunk is found, false otherwise.
Definition at line 359 of file Request.cpp.
◆ processBodySlice()
| bool Request::processBodySlice |
( |
| ) |
|
Unified method to prepare the body for the Response/CGI phase. For Content-Length bodies, this does nothing and returns true immediately. For Chunked bodies, it decodes PARSE_BYTE_SLICE bytes per call to prevent blocking.
- Returns
- true if the body is fully clean and ready, false if it needs more processing loops.
Definition at line 302 of file Request.cpp.
◆ getContentLength()
| long long Request::getContentLength |
( |
| ) |
const |
◆ getMethod()
◆ getURL()
| const std::string & Request::getURL |
( |
| ) |
const |
◆ getProtocol()
| const std::string & Request::getProtocol |
( |
| ) |
const |
◆ getQuery()
| const std::string & Request::getQuery |
( |
| ) |
const |
◆ getHeaders()
| const std::map< std::string, std::string > & Request::getHeaders |
( |
| ) |
const |
◆ getCookies()
| const std::map< std::string, std::string > & Request::getCookies |
( |
| ) |
const |
◆ getHeader()
| std::string Request::getHeader |
( |
const std::string & |
key | ) |
const |
Gets a specific header value.
- Returns
- The value, or empty string if not found.
Definition at line 267 of file Request.cpp.
◆ getCookie()
| std::string Request::getCookie |
( |
const std::string & |
key | ) |
const |
Gets a specific cookie value.
- Returns
- The value, or empty string if not found.
Definition at line 279 of file Request.cpp.
◆ getBodyStore()
Returns a reference to the DataStore to allow direct writing from recv().
Definition at line 390 of file Request.cpp.
◆ getReqState()
◆ getStatusCode()
| std::string Request::getStatusCode |
( |
| ) |
const |
◆ getMaxBytesToRead()
| size_t Request::getMaxBytesToRead |
( |
| ) |
const |
◆ getTotalBytesRead()
| size_t Request::getTotalBytesRead |
( |
| ) |
const |
◆ isComplete()
| bool Request::isComplete |
( |
| ) |
const |
◆ _parseRequestLine()
| void Request::_parseRequestLine |
( |
const std::string & |
line | ) |
|
|
private |
◆ _parseHeaderLine()
| void Request::_parseHeaderLine |
( |
const std::string & |
line | ) |
|
|
private |
◆ _parseCookies()
| void Request::_parseCookies |
( |
const std::string & |
cookieHeader | ) |
|
|
private |
◆ _typeOfReq()
| void Request::_typeOfReq |
( |
| ) |
|
|
private |
◆ _extractQueryFromURL()
| void Request::_extractQueryFromURL |
( |
| ) |
|
|
private |
◆ _methodName
◆ _URL
| std::string Request::_URL |
|
private |
◆ _protocol
| std::string Request::_protocol |
|
private |
◆ _query
| std::string Request::_query |
|
private |
◆ _contentLength
| long long Request::_contentLength |
|
private |
◆ _body
◆ _decodedBody
◆ _headers
| std::map<std::string, std::string> Request::_headers |
|
private |
◆ _cookies
| std::map<std::string, std::string> Request::_cookies |
|
private |
◆ _reqState
◆ _statusCode
| std::string Request::_statusCode |
|
private |
◆ _maxBodySize
| size_t Request::_maxBodySize |
|
private |
◆ _totalBytesRead
| size_t Request::_totalBytesRead |
|
private |
◆ _chunkSize
| size_t Request::_chunkSize |
|
private |
◆ _chunkDecodeOffset
| size_t Request::_chunkDecodeOffset |
|
private |
◆ _isBodyProcessed
| bool Request::_isBodyProcessed |
|
private |
◆ _chunkBuffer
| std::string Request::_chunkBuffer |
|
private |
◆ _ramParsePos
| size_t Request::_ramParsePos |
|
private |
The documentation for this class was generated from the following files: