#include <RequestParser.hpp>
◆ State
| Enumerator |
|---|
| READING_HEADERS | |
| HEADERS_READY | |
| READING_BODY | |
| REQUEST_READY | |
| ERROR | |
◆ RequestParser()
| http::RequestParser::RequestParser |
( |
Request & | req, |
|
|
size_t | maxHeaderSize ) |
- Parameters
-
| request | The Request object context to populate. |
| maxHeaderSize | Hard limit on header block size (prevents OOM). |
◆ errorStatus()
| HttpStatus http::RequestParser::errorStatus |
( |
| ) |
const |
◆ feed()
Feeds a chunk of raw socket data into the parser's state machine.
- Parameters
-
| chunk | Pointer to the data buffer. |
| size | Number of bytes in the buffer. |
- Returns
- The new state of the parser after consuming the chunk.
◆ handleChunkedBody()
| void http::RequestParser::handleChunkedBody |
( |
| ) |
|
|
private |
◆ handleContentLengthBody()
| void http::RequestParser::handleContentLengthBody |
( |
| ) |
|
|
private |
◆ hasLeftoverData()
| bool http::RequestParser::hasLeftoverData |
( |
| ) |
const |
|
inline |
◆ parseBody()
Internal: Tries to consume data from the buffer for the body.
- Returns
- New state (READING_BODY or REQUEST_READY).
◆ parseHeaders()
Internal: Tries to find and parse the full header block.
- Returns
- New state (READING_HEADERS or HEADERS_READY).
◆ proceedReadingBody()
Resumes parsing after the HEADERS_READY pause.
This tells the parser to check the body-related headers (Content-Length, Transfer-Encoding) and, crucially, the policy from the (now-routed) Request object to prepare for body reading.
- Precondition
- Call this only when state is HEADERS_READY.
- Returns
- The new state (e.g., READING_BODY or REQUEST_READY if no body).
◆ reset()
| void http::RequestParser::reset |
( |
| ) |
|
Resets the parser and the associated Request object for reuse.
◆ setError()
Sets the parser to an error state and updates the Request's status.
◆ setRequestReady()
| void http::RequestParser::setRequestReady |
( |
| ) |
|
|
private |
◆ state()
◆ writeToBodyFile()
| bool http::RequestParser::writeToBodyFile |
( |
const std::string & | data | ) |
|
|
private |
◆ buffer_
| std::string http::RequestParser::buffer_ |
|
private |
◆ bytesWrittenToBody_
| size_t http::RequestParser::bytesWrittenToBody_ |
|
private |
◆ chunkParser_
◆ contentLength_
| size_t http::RequestParser::contentLength_ |
|
private |
◆ errorStatus_
◆ isContentChunked_
| bool http::RequestParser::isContentChunked_ |
|
private |
◆ maxContentSize_
| size_t http::RequestParser::maxContentSize_ |
|
private |
◆ maxHeaderSize_
| size_t http::RequestParser::maxHeaderSize_ |
|
private |
◆ request_
| Request& http::RequestParser::request_ |
|
private |
◆ state_
| State http::RequestParser::state_ |
|
private |
The documentation for this class was generated from the following files: