#include <icy/http/packetizers.h>Inherits:
PacketProcessor
HTTP chunked transfer encoding adapter for streaming responses.
| Return | Name | Description |
|---|---|---|
Connection::Ptr | connection | HTTP connection to send the initial response header through. |
std::string | contentType | Content-Type value for the chunked response. |
std::string | frameSeparator | Optional separator written before each chunk payload. |
bool | initial | True until the first chunk is processed and the header emitted. |
bool | nocopy | If true, header/data/footer are emitted as separate packets. |
PacketSignal | emitter |
Connection::Ptr connectionHTTP connection to send the initial response header through.
std::string contentTypeContent-Type value for the chunked response.
std::string frameSeparatorOptional separator written before each chunk payload.
bool initialTrue until the first chunk is processed and the header emitted.
bool nocopyIf true, header/data/footer are emitted as separate packets.
PacketSignal emitter| Return | Name | Description |
|---|---|---|
ChunkedAdapter inline | Creates a ChunkedAdapter that sends its initial response header through the given connection. The content type is read from the connection's outgoing header. | |
ChunkedAdapter inline | Creates a ChunkedAdapter that emits its own raw HTTP/1.1 200 response header. Use this when no Connection object is available. | |
void | emitHeader virtual inline | Emits the initial HTTP/1.1 200 OK response headers with chunked transfer encoding. If a connection is set, headers are written through it; otherwise a raw response string is emitted via the packet signal. |
void | process virtual inline | Encodes an incoming packet as a chunked transfer encoding chunk and emits it. Emits the HTTP response headers on the first call. |
inline
inline ChunkedAdapter(Connection::Ptr connection, const std::string & frameSeparator, bool nocopy)Creates a ChunkedAdapter that sends its initial response header through the given connection. The content type is read from the connection's outgoing header.
connection HTTP connection to use. May be nullptr to emit a raw response instead.
frameSeparator Optional data prepended to each chunk payload.
nocopy If true, header and payload are emitted as separate packets (avoids copies).
inline
inline ChunkedAdapter(const std::string & contentType, const std::string & frameSeparator, bool nocopy)Creates a ChunkedAdapter that emits its own raw HTTP/1.1 200 response header. Use this when no Connection object is available.
contentType Content-Type value for the response.
frameSeparator Optional data prepended to each chunk payload.
nocopy If true, header and payload are emitted as separate packets.
virtual inline
virtual inline void emitHeader()Emits the initial HTTP/1.1 200 OK response headers with chunked transfer encoding. If a connection is set, headers are written through it; otherwise a raw response string is emitted via the packet signal.
virtual inline
virtual inline void process(IPacket & packet)Encodes an incoming packet as a chunked transfer encoding chunk and emits it. Emits the HTTP response headers on the first call.
packet Packet containing the raw payload data.std::invalid_argument if the packet does not carry data.