Outgoing HTTP response sent by the server. More...
#include <HttpConnection.h>
Public Member Functions | |
| Result | startResponse (int httpCode) |
| Starts the response with a http standard code (200 OK, 404 NOT FOUND etc.) | |
Public Member Functions inherited from SC::HttpOutgoingMessage | |
| 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. | |
Friends | |
| struct | HttpConnectionsPool |
| struct | HttpAsyncServer |
Additional Inherited Members | |
Protected Types inherited from SC::HttpOutgoingMessage | |
| enum class | KnownHeader : uint8_t { Connection , Host , UserAgent , ContentLength , ContentType , TransferEncoding } |
Protected Member Functions inherited from SC::HttpOutgoingMessage | |
| void | setHeaderMemory (Span< char > memory) |
| void | setWritableStream (AsyncWritableStream &stream) |
| bool | hasHeader (KnownHeader header) const |
| bool | hasSentHeaders () const |
| bool | hasEnded () const |
Protected Attributes inherited from SC::HttpOutgoingMessage | |
| 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 HTTP response sent by the server.
| Result SC::HttpResponse::startResponse | ( | int | httpCode | ) |
Starts the response with a http standard code (200 OK, 404 NOT FOUND etc.)