HTTP module

ConnectionStream

Packet stream wrapper for an HTTP connection.

ConnectionStream

#include <icy/http/connection.h>

Inherits: SocketAdapter

Packet stream wrapper for an HTTP connection.

Public Attributes

ReturnNameDescription
PacketStreamOutgoingThe Outgoing stream is responsible for packetizing raw application data into the agreed upon HTTP format and sending it to the peer.
PacketStreamIncomingThe Incoming stream emits incoming HTTP packets for processing by the application.
ProgressSignalIncomingProgressFired on download progress.
ProgressSignalOutgoingProgressFired on upload progress.

Outgoing

PacketStream Outgoing

The Outgoing stream is responsible for packetizing raw application data into the agreed upon HTTP format and sending it to the peer.


Incoming

PacketStream Incoming

The Incoming stream emits incoming HTTP packets for processing by the application.

This is useful for example when writing incoming data to a file.


IncomingProgress

ProgressSignal IncomingProgress

Fired on download progress.


OutgoingProgress

ProgressSignal OutgoingProgress

Fired on upload progress.

Public Methods

ReturnNameDescription
ConnectionStreamCreates a ConnectionStream wrapping the given HTTP connection. Wires the Outgoing stream emitter to the connection adapter and registers this stream to receive incoming data from the adapter.
ssize_tsend virtualSend data via the Outgoing stream.
Connection::PtrconnectionReturn a reference to the underlying connection.

ConnectionStream

ConnectionStream(Connection::Ptr connection)

Creates a ConnectionStream wrapping the given HTTP connection. Wires the Outgoing stream emitter to the connection adapter and registers this stream to receive incoming data from the adapter.

Parameters

  • connection The HTTP connection to wrap.

send

virtual

virtual ssize_t send(const char * data, size_t len, int flags)

Send data via the Outgoing stream.


connection

Connection::Ptr connection()

Return a reference to the underlying connection.

Protected Attributes

ReturnNameDescription
Connection::Ptr_connection

_connection

Connection::Ptr _connection

Protected Methods

ReturnNameDescription
boolonSocketRecv virtualCalled when data is received from the socket. Forwards the event to all registered receivers in priority order.

onSocketRecv

virtual

virtual bool onSocketRecv(net::Socket & socket, const MutableBuffer & buffer, const net::Address & peerAddress)

Called when data is received from the socket. Forwards the event to all registered receivers in priority order.

Parameters

  • socket The socket that received data.

  • buffer The received data buffer.

  • peerAddress Address of the sender.

Returns

true to stop propagation to subsequent receivers.