Incoming message from the perspective of the participants of an HTTP transaction.
More...
#include <HttpConnection.h>
|
| enum class | ChunkedState : uint8_t {
Size
,
SizeExtension
,
SizeLF
,
Data
,
DataCR
,
DataLF
,
TrailerLineStart
,
TrailerEndLF
,
Finished
} |
| |
|
|
void | resetIncoming (HttpParser::Type type, Span< char > memory) |
| |
|
bool | hasReceivedHeaders () const |
| |
|
Span< char > | getUnusedHeaderMemory () const |
| |
|
Result | initBodyStream (AsyncBuffersPool &buffersPool, Function< Result()> &&onReadRequest) |
| |
|
Result | startBodyStream () |
| |
|
bool | pushBodyData (AsyncBufferView::ID bufferID, size_t sizeInBytes) |
| |
|
void | finishBodyStream () |
| |
|
void | failBodyStream (Result result) |
| |
|
void | abortBodyStream () |
| |
|
Result | prepareBodyStream (AsyncBuffersPool &buffersPool, Function< Result()> &&onReadRequest, bool allowCloseDelimited) |
| |
|
Result | processBodyData (AsyncReadableStream &sourceStream, AsyncBufferView::ID bufferID, Span< const char > readData, bool allowTrailingData) |
| |
|
void | setBodyBytesRemaining (uint64_t value) |
| |
|
void | setBodyFramingKind (HttpBodyFramingKind value) |
| |
|
void | setBodyComplete (bool value) |
| |
|
void | attachReadableStream (AsyncReadableStream &stream) |
| |
| bool | findParserToken (HttpParser::Token token, StringSpan &res) const |
| | Finds a specific HttpParser::Result in the list of parsed header.
|
| |
| Result | writeHeaders (const uint32_t maxHeaderSize, Span< const char > readData, AsyncReadableStream &stream, AsyncBufferView::ID bufferID, const char *outOfSpaceError, const char *sizeExceededError, bool stopAtHeadersEnd, bool unshiftPendingBodyToStream=true) |
| | Parses an incoming slice of data eventually copying it to the availableHeader.
|
| |
| size_t | getHeadersLength () const |
| | Gets the length of the headers in bytes.
|
| |
|
|
HttpParsedHeaders | parsedHeaders |
| |
|
Span< char > | headerMemory |
| |
|
AsyncReadableStream * | readableStream = nullptr |
| |
|
uint64_t | bodyBytesRemaining = 0 |
| |
|
HttpBodyFramingKind | bodyFramingKind = HttpBodyFramingKind::None |
| |
|
bool | bodyComplete = true |
| |
|
bool | bodyStreamStarted = false |
| |
|
BodyStream | bodyStream |
| |
|
ChunkedState | chunkedState = ChunkedState::Size |
| |
|
uint64_t | chunkedChunkSize = 0 |
| |
|
uint64_t | chunkedBytesRemaining = 0 |
| |
|
bool | chunkedSizeHasDigits = false |
| |
Incoming message from the perspective of the participants of an HTTP transaction.
◆ consumeBodyBytes()
| Result SC::HttpIncomingMessage::consumeBodyBytes |
( |
size_t | bytes | ) |
|
Decrements the remaining body bytes after consuming data.
◆ findParserToken()
Finds a specific HttpParser::Result in the list of parsed header.
- Parameters
-
| token | The result to look for (Method, Url etc.) |
| res | A StringSpan, pointing at headerBuffer containing the found result |
- Returns
true if the result has been found
◆ getBodyBytesRemaining()
| uint64_t SC::HttpIncomingMessage::getBodyBytesRemaining |
( |
| ) |
const |
|
inlinenodiscard |
Returns how many body bytes are still expected for this message.
◆ getBodyFramingKind()
| HttpBodyFramingKind SC::HttpIncomingMessage::getBodyFramingKind |
( |
| ) |
const |
|
inlinenodiscard |
Returns the effective framing mode for the incoming body.
◆ getBoundary()
| StringSpan SC::HttpIncomingMessage::getBoundary |
( |
| ) |
const |
|
nodiscard |
Gets the multipart boundary string (if isMultipart() returns true)
◆ getHeader()
Gets the value of a specific header (case-insensitive name matching)
- Parameters
-
| headerName | The name of the header to find |
| value | Output parameter that receives the header value if found |
- Returns
true if the header was found
◆ getHeadersLength()
| size_t SC::HttpIncomingMessage::getHeadersLength |
( |
| ) |
const |
|
nodiscardprotected |
Gets the length of the headers in bytes.
◆ getKeepAlive()
| bool SC::HttpIncomingMessage::getKeepAlive |
( |
| ) |
const |
|
inlinenodiscard |
Gets whether the other party requested the connection to stay alive.
◆ getParser()
| const HttpParser & SC::HttpIncomingMessage::getParser |
( |
| ) |
const |
|
inline |
◆ getReadableStream() [1/2]
Obtains the readable stream for the message body.
◆ getReadableStream() [2/2]
Obtains the readable stream for the message body.
◆ isBodyComplete()
| bool SC::HttpIncomingMessage::isBodyComplete |
( |
| ) |
const |
|
inlinenodiscard |
Returns true once the full body has been received according to its framing.
◆ isMultipart()
| bool SC::HttpIncomingMessage::isMultipart |
( |
| ) |
const |
|
nodiscard |
Checks if the request is a multipart/form-data request.
◆ writeHeaders()
| Result SC::HttpIncomingMessage::writeHeaders |
( |
const uint32_t | maxHeaderSize, |
|
|
Span< const char > | readData, |
|
|
AsyncReadableStream & | stream, |
|
|
AsyncBufferView::ID | bufferID, |
|
|
const char * | outOfSpaceError, |
|
|
const char * | sizeExceededError, |
|
|
bool | stopAtHeadersEnd, |
|
|
bool | unshiftPendingBodyToStream = true ) |
|
protected |
Parses an incoming slice of data eventually copying it to the availableHeader.
If it encounters body data, it will create a child view and unshift it to the stream.
The documentation for this struct was generated from the following file: