Incoming message from the perspective of the participants of an HTTP transaction. More...
#include <HttpConnection.h>
Public Member Functions | |
| const HttpParser & | getParser () const |
| Gets the associated HttpParser. | |
| bool | getKeepAlive () const |
| Gets whether the other party requested the connection to stay alive. | |
| uint64_t | getBodyBytesRemaining () const |
| Returns how many body bytes are still expected for this message. | |
| bool | isMultipart () const |
| Checks if the request is a multipart/form-data request. | |
| StringSpan | getBoundary () const |
| Gets the multipart boundary string (if isMultipart() returns true) | |
| bool | getHeader (StringSpan headerName, StringSpan &value) const |
| Gets the value of a specific header (case-insensitive name matching) | |
| AsyncReadableStream & | getReadableStream () |
| Obtains the readable stream for the message body. | |
| const AsyncReadableStream & | getReadableStream () const |
| Obtains the readable stream for the message body. | |
| Result | consumeBodyBytes (size_t bytes) |
| Decrements the remaining body bytes after consuming data. | |
Protected Member Functions | |
| void | resetIncoming (HttpParser::Type type, Span< char > memory) |
| bool | hasReceivedHeaders () const |
| Span< char > | getUnusedHeaderMemory () const |
| void | attachReadableStream (AsyncReadableStream &stream) |
| void | setBodyBytesRemaining (uint64_t value) |
| 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) |
| Parses an incoming slice of data eventually copying it to the availableHeader. | |
| size_t | getHeadersLength () const |
| Gets the length of the headers in bytes. | |
Protected Attributes | |
| HttpParsedHeaders | parsedHeaders |
| Span< char > | headerMemory |
| AsyncReadableStream * | readableStream = nullptr |
| uint64_t | bodyBytesRemaining = 0 |
Incoming message from the perspective of the participants of an HTTP transaction.
Decrements the remaining body bytes after consuming data.
|
nodiscardprotected |
Finds a specific HttpParser::Result in the list of parsed header.
| token | The result to look for (Method, Url etc.) |
| res | A StringSpan, pointing at headerBuffer containing the found result |
true if the result has been found
|
inlinenodiscard |
Returns how many body bytes are still expected for this message.
|
nodiscard |
Gets the multipart boundary string (if isMultipart() returns true)
|
nodiscard |
Gets the value of a specific header (case-insensitive name matching)
| headerName | The name of the header to find |
| value | Output parameter that receives the header value if found |
true if the header was found
|
nodiscardprotected |
Gets the length of the headers in bytes.
|
inlinenodiscard |
Gets whether the other party requested the connection to stay alive.
|
inline |
Gets the associated HttpParser.
| AsyncReadableStream & SC::HttpIncomingMessage::getReadableStream | ( | ) |
Obtains the readable stream for the message body.
| const AsyncReadableStream & SC::HttpIncomingMessage::getReadableStream | ( | ) | const |
Obtains the readable stream for the message body.
|
nodiscard |
Checks if the request is a multipart/form-data request.
|
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.