VLC  4.0.0-dev
Data Structures | Functions | Variables
Include dependency graph for message.h:

Go to the source code of this file.

Data Structures

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

Functions

struct vlc_http_msgvlc_http_req_create (const char *method, const char *scheme, const char *authority, const char *path) VLC_USED
 Creates an HTTP request. More...
 
struct vlc_http_msgvlc_http_resp_create (unsigned status) VLC_USED
 Creates an HTTP response. More...
 
void vlc_http_msg_destroy (struct vlc_http_msg *)
 Destroys an HTTP message. More...
 
int vlc_http_msg_add_header (struct vlc_http_msg *, const char *name, const char *fmt,...) VLC_FORMAT(3
 Formats a header field. More...
 
int char * vlc_http_authority (const char *host, unsigned port)
 Formats an authority. More...
 
int vlc_http_msg_add_agent (struct vlc_http_msg *, const char *)
 Sets the agent field. More...
 
const char * vlc_http_msg_get_agent (const struct vlc_http_msg *)
 Gets the agent field. More...
 
time_t vlc_http_msg_get_time (const struct vlc_http_msg *, const char *name)
 Parses a timestamp header field. More...
 
int vlc_http_msg_add_time (struct vlc_http_msg *, const char *name, const time_t *t)
 Adds a timestamp header field. More...
 
int vlc_http_msg_add_atime (struct vlc_http_msg *)
 Adds a Date header field. More...
 
time_t vlc_http_msg_get_atime (const struct vlc_http_msg *)
 Gets message date. More...
 
time_t vlc_http_msg_get_mtime (const struct vlc_http_msg *)
 Gets resource date. More...
 
unsigned vlc_http_msg_get_retry_after (const struct vlc_http_msg *)
 Gets retry timeout. More...
 
void vlc_http_msg_get_cookies (const struct vlc_http_msg *, struct vlc_http_cookie_jar_t *, const char *host, const char *path)
 
int vlc_http_msg_add_cookies (struct vlc_http_msg *, struct vlc_http_cookie_jar_t *)
 
char * vlc_http_msg_get_basic_realm (const struct vlc_http_msg *)
 
int vlc_http_msg_add_creds_basic (struct vlc_http_msg *, bool proxy, const char *username, const char *password)
 Adds Basic credentials. More...
 
const char * vlc_http_msg_get_header (const struct vlc_http_msg *, const char *name)
 Looks up an header field. More...
 
int vlc_http_msg_get_status (const struct vlc_http_msg *m)
 Gets response status code. More...
 
const char * vlc_http_msg_get_method (const struct vlc_http_msg *)
 Gets request method. More...
 
const char * vlc_http_msg_get_scheme (const struct vlc_http_msg *)
 Gets request scheme. More...
 
const char * vlc_http_msg_get_authority (const struct vlc_http_msg *)
 Gets request authority. More...
 
const char * vlc_http_msg_get_path (const struct vlc_http_msg *)
 Gets request absolute path. More...
 
const char * vlc_http_msg_get_token (const struct vlc_http_msg *, const char *field, const char *token)
 Looks up a token in a header field. More...
 
const char * vlc_http_next_token (const char *)
 Finds next token. More...
 
uintmax_t vlc_http_msg_get_size (const struct vlc_http_msg *)
 Gets HTTP payload length. More...
 
struct vlc_http_msgvlc_http_msg_iterate (struct vlc_http_msg *) VLC_USED
 Gets next response headers. More...
 
struct vlc_http_msgvlc_http_msg_get_final (struct vlc_http_msg *) VLC_USED
 Gets final response headers. More...
 
struct block_tvlc_http_msg_read (struct vlc_http_msg *) VLC_USED
 Receives HTTP data. More...
 
int vlc_http_msg_write (struct vlc_http_msg *, block_t *b, bool eos)
 Sends HTTP data. 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 ssize_t vlc_http_stream_write (struct vlc_http_stream *s, const void *base, size_t length, bool eos)
 Write message payload data. 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...
 
char * vlc_http_msg_format (const struct vlc_http_msg *m, size_t *restrict lenp, bool proxied, bool chunked) VLC_USED
 Formats an HTTP 1.1 message header. More...
 
struct vlc_http_msgvlc_http_msg_headers (const char *msg) VLC_USED
 Parses an HTTP 1.1 message header. More...
 
struct vlc_h2_framevlc_http_msg_h2_frame (const struct vlc_http_msg *m, uint_fast32_t stream_id, bool eos)
 Formats an HTTP 2.0 HEADER frame. More...
 
struct vlc_http_msgvlc_http_msg_h2_headers (unsigned count, const char *const headers[][2])
 Parses an HTTP 2.0 header table. More...
 

Variables

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

Function Documentation

◆ vlc_http_msg_format()

char* vlc_http_msg_format ( const struct vlc_http_msg m,
size_t *restrict  lenp,
bool  proxied,
bool  chunked 
)

Formats an HTTP 1.1 message header.

Formats an message header in HTTP 1.x format, using HTTP version 1.1.

Parameters
mmessage to format/serialize
lenplocation to write the length of the formatted message in bytes [OUT]
proxiedwhether the message is meant for sending to a proxy rather than an origin (only relevant for requests)
chunkedwhether to append a chunked transfer encoding header line
Returns
A heap-allocated nul-terminated string or *lenp bytes, or NULL on error

References vlc_http_msg::authority, vlc_http_msg::count, vlc_http_msg::headers, vlc_http_msg::method, vlc_http_msg::path, vlc_http_msg::scheme, vlc_http_msg::status, vlc_memstream::stream, vlc_memstream_close(), vlc_memstream_open(), vlc_memstream_printf(), and vlc_memstream_puts().

Referenced by vlc_h1_stream_open().

◆ vlc_http_msg_h2_frame()

struct vlc_h2_frame* vlc_http_msg_h2_frame ( const struct vlc_http_msg m,
uint_fast32_t  stream_id,
bool  eos 
)

◆ vlc_http_msg_h2_headers()

struct vlc_http_msg* vlc_http_msg_h2_headers ( unsigned  count,
const char *const  headers[][2] 
)

◆ vlc_http_msg_headers()

struct vlc_http_msg* vlc_http_msg_headers ( const char *  msg)

Parses an HTTP 1.1 message header.

References name, strndup(), unlikely, vlc_http_msg_add_header(), vlc_http_msg_destroy(), and vlc_http_resp_create().

Referenced by vlc_h1_stream_wait().