HTTP module

MultipartAdapter

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

MultipartAdapter

#include <icy/http/packetizers.h>

Inherits: PacketProcessor

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

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

HTTP connection for sending the initial response header.


contentType

std::string contentType

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


isBase64

bool isBase64

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


initial

bool initial

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


emitter

PacketSignal emitter

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)

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](icy-base64.html#base64) If true, indicates parts are base64-encoded.


MultipartAdapter

inline

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

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](icy-base64.html#base64) If true, indicates parts are base64-encoded.


emitHeader

virtual inline

virtual inline void emitHeader()

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()

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)

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.