Outgoing message from the perspective of the participants of an HTTP transaction. More...
#include <HttpConnection.h>
Public Member Functions | |
| Result | addHeader (StringSpan headerName, StringSpan headerValue) |
| Writes an http header to this response. | |
| Result | sendHeaders (Function< void(AsyncBufferView::ID)> callback={}) |
| Start sending response headers, before sending any data. | |
| void | reset () |
| Resets this object for it to be re-usable. | |
| Result | end () |
| Finalizes the writable stream after sending all in progress writes. | |
| AsyncWritableStream & | getWritableStream () |
| Obtain writable stream for sending content back to connected client. | |
| void | setKeepAlive (bool keepAlive) |
| Sets whether to keep the connection alive after this response. | |
| bool | getKeepAlive () const |
| Gets whether the connection should be kept alive after this response. | |
Protected Types | |
| enum class | KnownHeader : uint8_t { Connection , Host , UserAgent , ContentLength , ContentType , TransferEncoding } |
Protected Member Functions | |
| void | setHeaderMemory (Span< char > memory) |
| void | setWritableStream (AsyncWritableStream &stream) |
| bool | hasHeader (KnownHeader header) const |
| bool | hasSentHeaders () const |
| bool | hasEnded () const |
Protected Attributes | |
| HttpFixedBufferWriter | responseHeaders |
| Span< char > | headerMemory |
| bool | headersSent = false |
| bool | endCalled = false |
| bool | forceDisableKeepAlive = false |
| Whether keep alive has been force disabled permanently. | |
| bool | keepAlive = true |
| Whether to keep connection alive (HTTP/1.1 default) | |
| bool | connectionHeaderAdded = false |
| Whether Connection header was manually added. | |
| bool | hostHeaderAdded = false |
| bool | userAgentHeaderAdded = false |
| bool | contentLengthAdded = false |
| bool | contentTypeAdded = false |
| bool | transferEncodingAdded = false |
| AsyncWritableStream * | writableStream = nullptr |
Outgoing message from the perspective of the participants of an HTTP transaction.
| Result SC::HttpOutgoingMessage::addHeader | ( | StringSpan | headerName, |
| StringSpan | headerValue ) |
Writes an http header to this response.
| Result SC::HttpOutgoingMessage::end | ( | ) |
Finalizes the writable stream after sending all in progress writes.
|
inlinenodiscard |
Gets whether the connection should be kept alive after this response.
|
inline |
Obtain writable stream for sending content back to connected client.
| void SC::HttpOutgoingMessage::reset | ( | ) |
Resets this object for it to be re-usable.
| Result SC::HttpOutgoingMessage::sendHeaders | ( | Function< void(AsyncBufferView::ID)> | callback = {} | ) |
Start sending response headers, before sending any data.
| void SC::HttpOutgoingMessage::setKeepAlive | ( | bool | keepAlive | ) |
Sets whether to keep the connection alive after this response.
| keepAlive | true to keep connection open for more requests, false to close after response |
|
protected |
Whether Connection header was manually added.
|
protected |
Whether keep alive has been force disabled permanently.
|
protected |
Whether to keep connection alive (HTTP/1.1 default)