ChunkedAdapter
#include <icy/http/packetizers.h>
class ChunkedAdapterDefined in src/http/include/icy/http/packetizers.h:29
- Inherits
PacketProcessor
List of all members
| Name | Kind | Owner |
|---|---|---|
connection | variable | Declared here |
contentType | variable | Declared here |
frameSeparator | variable | Declared here |
initial | variable | Declared here |
nocopy | variable | Declared here |
emitter | variable | Declared here |
ChunkedAdapter | function | Declared here |
ChunkedAdapter | function | Declared here |
~ChunkedAdapter | function | Declared here |
emitHeader | function | Declared here |
process | function | Declared here |
PacketProcessor | function | Inherited from PacketProcessor |
process | function | Inherited from PacketProcessor |
accepts | function | Inherited from PacketProcessor |
operator<< | function | Inherited from PacketProcessor |
PacketStreamAdapter | function | Inherited from PacketStreamAdapter |
~PacketStreamAdapter | function | Inherited from PacketStreamAdapter |
emit | function | Inherited from PacketStreamAdapter |
emit | function | Inherited from PacketStreamAdapter |
emit | function | Inherited from PacketStreamAdapter |
emit | function | Inherited from PacketStreamAdapter |
emit | function | Inherited from PacketStreamAdapter |
getEmitter | function | Inherited from PacketStreamAdapter |
retention | function | Inherited from PacketStreamAdapter |
onStreamStateChange | function | Inherited from PacketStreamAdapter |
_emitter | variable | Inherited from PacketStreamAdapter |
PacketStreamAdapter | function | Inherited from PacketStreamAdapter |
operator= | function | Inherited from PacketStreamAdapter |
PacketStreamAdapter | function | Inherited from PacketStreamAdapter |
operator= | function | Inherited from PacketStreamAdapter |
Inherited from PacketProcessor
| Kind | Name | Description |
|---|---|---|
function | PacketProcessor inline | |
function | process virtual | This method performs processing on the given packet and emits the result. |
function | accepts virtual inline | This method ensures compatibility with the given packet type. Return false to reject the packet. |
function | operator<< virtual inline | Stream operator alias for process() |
Inherited from PacketStreamAdapter
| Kind | Name | Description |
|---|---|---|
function | PacketStreamAdapter | Construct the adapter, binding it to the given packet signal. |
function | ~PacketStreamAdapter virtual inline | |
function | emit virtual | Emit a mutable raw buffer as a packet. |
function | emit virtual | Emit a read-only raw buffer as a packet (data is copied internally). |
function | emit virtual | Emit a string as a packet (data is copied internally). |
function | emit virtual | Emit a flag-only packet carrying no payload data. |
function | emit virtual | Emit an existing packet directly onto the outgoing signal. |
function | getEmitter | Returns a reference to the outgoing packet signal. |
function | retention virtual const | Returns how this adapter treats incoming packet lifetime. Most adapters are synchronous and therefore only borrow the packet for the current call chain. Queue-style adapters override this to advertise that they clone before deferred use. Callers may treat the first adapter reporting Cloned or Retained as the explicit ownership boundary in the stream graph. |
function | onStreamStateChange virtual inline | Called by the PacketStream to notify when the internal Stream state changes. On receiving the Stopped state, it is the responsibility of the adapter to have ceased all outgoing packet transmission, especially in multi-thread scenarios. |
variable | _emitter | |
function | PacketStreamAdapter | NonCopyable and NonMovable. |
function | operator= | Deleted assignment operator. |
function | PacketStreamAdapter | Deleted constructor. |
function | operator= | Deleted assignment operator. |
Public Attributes
| 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
Connection::Ptr connectionType: Connection::Ptr
Defined in src/http/include/icy/http/packetizers.h:32
HTTP connection to send the initial response header through.
contentType
std::string contentTypeDefined in src/http/include/icy/http/packetizers.h:33
Content-Type value for the chunked response.
frameSeparator
std::string frameSeparatorDefined in src/http/include/icy/http/packetizers.h:34
Optional separator written before each chunk payload.
initial
bool initialDefined in src/http/include/icy/http/packetizers.h:35
True until the first chunk is processed and the header emitted.
nocopy
bool nocopyDefined in src/http/include/icy/http/packetizers.h:36
If true, header/data/footer are emitted as separate packets.
emitter
PacketSignal emitterType: PacketSignal
Defined in src/http/include/icy/http/packetizers.h:146
Public Methods
| 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. | |
~ChunkedAdapter virtual inline | ||
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 override | Encodes an incoming packet as a chunked transfer encoding chunk and emits it. Emits the HTTP response headers on the first call. |
ChunkedAdapter
inline
inline ChunkedAdapter(Connection::Ptr connection = nullptr, const std::string & frameSeparator = "", bool nocopy = true)Defined in src/http/include/icy/http/packetizers.h:43
Creates a ChunkedAdapter that sends its initial response header through the given connection. The content type is read from the connection's outgoing header.
Parameters
| Parameter | Type | Description |
|---|---|---|
connection | Connection::Ptr | HTTP connection to use. May be nullptr to emit a raw response instead. |
frameSeparator | const std::string & | Optional data prepended to each chunk payload. |
nocopy | bool | If true, header and payload are emitted as separate packets (avoids copies). |
ChunkedAdapter
inline
inline ChunkedAdapter(const std::string & contentType, const std::string & frameSeparator = "", bool nocopy = true)Defined in src/http/include/icy/http/packetizers.h:56
Creates a ChunkedAdapter that emits its own raw HTTP/1.1 200 response header. Use this when no Connection object is available.
Parameters
| Parameter | Type | Description |
|---|---|---|
contentType | const std::string & | Content-Type value for the response. |
frameSeparator | const std::string & | Optional data prepended to each chunk payload. |
nocopy | bool | If true, header and payload are emitted as separate packets. |
~ChunkedAdapter
virtual inline
virtual inline ~ChunkedAdapter()Defined in src/http/include/icy/http/packetizers.h:66
emitHeader
virtual inline
virtual inline void emitHeader()Defined in src/http/include/icy/http/packetizers.h:71
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.
process
virtual inline override
virtual inline void process(IPacket & packet) overrideDefined in src/http/include/icy/http/packetizers.h:108
Encodes an incoming packet as a chunked transfer encoding chunk and emits it. Emits the HTTP response headers on the first call.
Reimplements
Parameters
| Parameter | Type | Description |
|---|---|---|
packet | IPacket & | Packet containing the raw payload data. |
Exceptions
| Exception | Description |
|---|---|
std::invalid_argument | if the packet does not carry data. |
