VLC  3.0.0-git
Data Structures | Functions | Variables

HTTP request/response streams. More...

Collaboration diagram for Streams:

Data Structures

struct  vlc_http_stream_cbs
 HTTP stream callbacks. More...
struct  vlc_http_stream
 HTTP stream. More...


void vlc_http_msg_attach (struct vlc_http_msg *m, struct vlc_http_stream *s)
struct vlc_http_msgvlc_http_msg_get_initial (struct vlc_http_stream *s) VLC_USED
static struct vlc_http_msgvlc_http_stream_read_headers (struct vlc_http_stream *s)
 Reads one message header. More...
static struct block_tvlc_http_stream_read (struct vlc_http_stream *s)
 Reads message payload data. More...
static void vlc_http_stream_close (struct vlc_http_stream *s, bool abort)
 Closes an HTTP stream. More...


void *const vlc_http_error
 Error pointer value. More...

Detailed Description

HTTP request/response streams.

A stream is initiated by a client-side request header. It includes a final response header, possibly preceded by one or more continuation response headers. After the response header, a stream usually carries a response payload.

A stream may also carry a request payload (this is not supported so far).

The HTTP stream constitutes the interface between an HTTP connection and the higher-level HTTP messages layer.

Function Documentation

◆ vlc_http_msg_attach()

void vlc_http_msg_attach ( struct vlc_http_msg m,
struct vlc_http_stream s 

◆ vlc_http_msg_get_initial()

struct vlc_http_msg* vlc_http_msg_get_initial ( struct vlc_http_stream s)

◆ vlc_http_stream_close()

static void vlc_http_stream_close ( struct vlc_http_stream s,
bool  abort 

Closes an HTTP stream.

Releases all resources associated or held by an HTTP stream. Any unread header or data is discarded.

References vlc_http_stream::cbs, vlc_http_stream_cbs::close, count, vlc_http_msg::headers, vlc_http_msg_format(), vlc_http_msg_h2_frame(), vlc_http_msg_h2_headers(), vlc_http_msg_headers(), and VLC_USED.

Referenced by vlc_chunked_close(), vlc_http_msg_destroy(), and vlc_http_msg_get_initial().

◆ vlc_http_stream_read()

static struct block_t* vlc_http_stream_read ( struct vlc_http_stream s)

Reads message payload data.

Reads the next block of data from the message payload of an HTTP stream.

a block of data (use block_Release() to free it)
Return values
NULLThe end of the stream was reached.
vlc_http_errorThe stream encountered a fatal error.

References vlc_http_stream::cbs, and vlc_http_stream_cbs::read.

Referenced by vlc_http_msg_read().

◆ vlc_http_stream_read_headers()

static struct vlc_http_msg* vlc_http_stream_read_headers ( struct vlc_http_stream s)

Reads one message header.

Reads the next message header of an HTTP stream from the network. There is always exactly one request header per stream. There is usually one response header per stream, except for continuation (1xx) headers.

The caller is responsible for reading headers at appropriate times as intended by the protocol. Failure to do so may result in protocol dead lock, and/or (HTTP 1.x) connection failure.

References vlc_http_stream::cbs, and vlc_http_stream_cbs::read_headers.

Referenced by vlc_http_msg_get_initial(), and vlc_http_msg_iterate().

Variable Documentation

◆ vlc_http_error

void* const vlc_http_error

Error pointer value.

This is an error value for some HTTP functions that can return NULL in non-error circumstances. Another return value is necessary to express error/failure, which this is. This compares different to NULL and to any valid pointer.

Dereferencing this pointer is undefined.

Referenced by vlc_chunked_fatal(), vlc_chunked_read(), vlc_h1_stream_read(), vlc_h2_stream_read(), vlc_http_file_read(), and vlc_http_live_read().