Home
HTTP module

MultipartAdapter

HTTP multipart encoding adapter for multipart/x-mixed-replace streaming.

MultipartAdapter

#include <icy/http/packetizers.h>
class MultipartAdapter

Defined in src/http/include/icy/http/packetizers.h:159

Inherits: PacketProcessor

HTTP multipart encoding adapter for multipart/x-mixed-replace streaming.

List of all members

NameKindOwner
connectionvariableDeclared here
contentTypevariableDeclared here
isBase64variableDeclared here
initialvariableDeclared here
emittervariableDeclared here
MultipartAdapterfunctionDeclared here
MultipartAdapterfunctionDeclared here
~MultipartAdapterfunctionDeclared here
emitHeaderfunctionDeclared here
emitChunkHeaderfunctionDeclared here
processfunctionDeclared here
PacketProcessorfunctionInherited from PacketProcessor
processfunctionInherited from PacketProcessor
acceptsfunctionInherited from PacketProcessor
operator<<functionInherited from PacketProcessor
PacketStreamAdapterfunctionInherited from PacketStreamAdapter
~PacketStreamAdapterfunctionInherited from PacketStreamAdapter
emitfunctionInherited from PacketStreamAdapter
emitfunctionInherited from PacketStreamAdapter
emitfunctionInherited from PacketStreamAdapter
emitfunctionInherited from PacketStreamAdapter
emitfunctionInherited from PacketStreamAdapter
getEmitterfunctionInherited from PacketStreamAdapter
retentionfunctionInherited from PacketStreamAdapter
onStreamStateChangefunctionInherited from PacketStreamAdapter
_emittervariableInherited from PacketStreamAdapter
PacketStreamAdapterfunctionInherited from PacketStreamAdapter
operator=functionInherited from PacketStreamAdapter
PacketStreamAdapterfunctionInherited from PacketStreamAdapter
operator=functionInherited from PacketStreamAdapter

Inherited from PacketProcessor

KindNameDescription
functionPacketProcessor inline
functionprocess virtualThis method performs processing on the given packet and emits the result.
functionaccepts virtual inlineThis method ensures compatibility with the given packet type. Return false to reject the packet.
functionoperator<< virtual inlineStream operator alias for process()

Inherited from PacketStreamAdapter

KindNameDescription
functionPacketStreamAdapterConstruct the adapter, binding it to the given packet signal.
function~PacketStreamAdapter virtual inline
functionemit virtualEmit a mutable raw buffer as a packet.
functionemit virtualEmit a read-only raw buffer as a packet (data is copied internally).
functionemit virtualEmit a string as a packet (data is copied internally).
functionemit virtualEmit a flag-only packet carrying no payload data.
functionemit virtualEmit an existing packet directly onto the outgoing signal.
functiongetEmitterReturns a reference to the outgoing packet signal.
functionretention virtual constReturns 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.
functiononStreamStateChange virtual inlineCalled 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
functionPacketStreamAdapterNonCopyable and NonMovable.
functionoperator=Deleted assignment operator.
functionPacketStreamAdapterDeleted constructor.
functionoperator=Deleted assignment operator.

Public Attributes

ReturnNameDescription
Connection::PtrconnectionHTTP connection for sending the initial response header.
std::stringcontentTypeContent-Type of each part (e.g. "image/jpeg").
boolisBase64If true, adds "Content-Transfer-Encoding: base64" to each part.
boolinitialTrue until the first chunk is processed and the boundary header emitted.
PacketSignalemitter

connection

Connection::Ptr connection

Defined in src/http/include/icy/http/packetizers.h:162

HTTP connection for sending the initial response header.


contentType

std::string contentType

Defined in src/http/include/icy/http/packetizers.h:163

Content-Type of each part (e.g. "image/jpeg").


isBase64

bool isBase64

Defined in src/http/include/icy/http/packetizers.h:164

If true, adds "Content-Transfer-Encoding: base64" to each part.


initial

bool initial

Defined in src/http/include/icy/http/packetizers.h:165

True until the first chunk is processed and the boundary header emitted.


emitter

PacketSignal emitter

Defined in src/http/include/icy/http/packetizers.h:264

Public Methods

ReturnNameDescription
MultipartAdapter inlineCreates a MultipartAdapter that sends headers through the given connection. The per-part content type is read from the connection's outgoing header.
MultipartAdapter inlineCreates a MultipartAdapter that emits its own raw HTTP/1.1 200 response header. Use this when no Connection object is available.
voidemitHeader virtual inlineEmits the initial HTTP/1.1 200 OK response with Content-Type multipart/x-mixed-replace. If a connection is set, headers are written through it; otherwise a raw response string is emitted.
voidemitChunkHeader virtual inlineEmits the MIME boundary and per-part headers (Content-Type, optionally Content-Transfer-Encoding) for the next multipart chunk.
voidprocess virtual inlineWraps the incoming packet as a multipart chunk and emits it downstream. Emits the multipart HTTP response headers on the first call.

MultipartAdapter

inline

inline MultipartAdapter(Connection::Ptr connection, bool base64 = false)

Defined in src/http/include/icy/http/packetizers.h:171

Creates a MultipartAdapter that sends headers through the given connection. The per-part content type is read from the connection's outgoing header.

Parameters

  • connection HTTP connection to use for sending the initial multipart header.

  • [base64](base.html#base64) If true, indicates parts are base64-encoded.


MultipartAdapter

inline

inline MultipartAdapter(const std::string & contentType, bool base64 = false)

Defined in src/http/include/icy/http/packetizers.h:184

Creates a MultipartAdapter that emits its own raw HTTP/1.1 200 response header. Use this when no Connection object is available.

Parameters

  • contentType Content-Type for each multipart part.

  • [base64](base.html#base64) If true, indicates parts are base64-encoded.


emitHeader

virtual inline

virtual inline void emitHeader()

Defined in src/http/include/icy/http/packetizers.h:197

Emits the initial HTTP/1.1 200 OK response with Content-Type multipart/x-mixed-replace. If a connection is set, headers are written through it; otherwise a raw response string is emitted.


emitChunkHeader

virtual inline

virtual inline void emitChunkHeader()

Defined in src/http/include/icy/http/packetizers.h:231

Emits the MIME boundary and per-part headers (Content-Type, optionally Content-Transfer-Encoding) for the next multipart chunk.


process

virtual inline

virtual inline void process(IPacket & packet)

Defined in src/http/include/icy/http/packetizers.h:248

Wraps the incoming packet as a multipart chunk and emits it downstream. Emits the multipart HTTP response headers on the first call.

Parameters

  • packet Packet containing the raw payload data.
Reimplements