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

Variables

void *const vlc_http_error
 Error pointer value.
 

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