Go to the documentation of this file.
157 const
char *host, const
char *
path);
177 const
char *username, const
char *password);
239 const
char *field, const
char *token);
402 const void *base,
size_t length,
405 return s->
cbs->
write(s, base, length, eos);
450 bool proxied,
bool chunked)
VLC_USED;
463 uint_fast32_t stream_id,
bool eos);
469 const char *
const headers[][2]);
unsigned vlc_http_msg_get_retry_after(const struct vlc_http_msg *m)
Gets retry timeout.
Definition: message.c:882
size_t count
Definition: core.c:401
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.
Definition: message.c:331
const char * vlc_http_msg_get_path(const struct vlc_http_msg *m)
Gets request absolute path.
Definition: message.c:188
char * vlc_http_msg_get_basic_realm(const struct vlc_http_msg *m)
Definition: message.c:987
In-memory stream object.
Definition: vlc_memstream.h:41
static void block_ChainRelease(block_t *p_block)
Definition: vlc_block.h:358
static const char vlc_http_error_loc
Definition: message.c:55
static int vlc_http_istoken(int c)
Definition: message.c:585
int strcasecmp(const char *, const char *)
static size_t vlc_http_token_length(const char *str)
Definition: message.c:600
char * vlc_http_authority(const char *host, unsigned port)
Formats an authority.
Definition: message.c:573
#define unlikely(p)
Predicted false condition.
Definition: vlc_common.h:227
struct vlc_h2_frame * vlc_http_msg_h2_frame(const struct vlc_http_msg *m, uint_fast32_t stream_id, bool eos)
Formats an HTTP 2.0 HEADER frame.
Definition: message.c:425
const struct vlc_http_stream_cbs * cbs
Definition: message.h:368
static struct vlc_http_msg * vlc_http_stream_read_headers(struct vlc_http_stream *s)
Reads one message header.
Definition: message.h:383
const char * vlc_http_msg_get_method(const struct vlc_http_msg *m)
Gets request method.
Definition: message.c:173
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.
Definition: message.c:331
size_t i_buffer
Payload length.
Definition: vlc_block.h:122
struct vlc_http_msg * vlc_http_msg_h2_headers(unsigned n, const char *const hdrs[][2])
Parses an HTTP 2.0 header table.
Definition: message.c:487
int vlc_http_msg_add_creds_basic(struct vlc_http_msg *m, bool proxy, const char *username, const char *password)
Adds Basic credentials.
Definition: message.c:1005
struct tm * gmtime_r(const time_t *, struct tm *)
void vlc_http_msg_destroy(struct vlc_http_msg *m)
Destroys an HTTP message.
Definition: message.c:193
struct vlc_http_msg * vlc_http_msg_h2_headers(unsigned count, const char *const headers[][2])
Parses an HTTP 2.0 header table.
Definition: message.c:487
unsigned count
Definition: message.c:68
static size_t vlc_http_comment_length(const char *str)
Definition: message.c:715
struct vlc_http_msg * vlc_http_msg_iterate(struct vlc_http_msg *m)
Gets next response headers.
Definition: message.c:265
struct vlc_http_msg *(* read_headers)(struct vlc_http_stream *)
Definition: message.h:359
static struct block_t * vlc_http_stream_read(struct vlc_http_stream *s)
Reads message payload data.
Definition: message.h:417
int() vlc_memstream_puts(struct vlc_memstream *ms, const char *str)
Appends a nul-terminated string to a byte stream.
Definition: memstream.c:156
static const char * vlc_http_get_token(const char *value, const char *token)
Definition: message.c:652
static size_t vlc_http_quoted_length(const char *str)
Definition: message.c:609
char * vlc_http_cookies_fetch(vlc_http_cookie_jar_t *p_jar, bool secure, const char *host, const char *path)
Returns a cookie value that match the given URL.
Definition: httpcookies.c:351
int vlc_memstream_open(struct vlc_memstream *ms)
Initializes a byte stream object.
Definition: memstream.c:105
const char * vlc_http_next_token(const char *value)
Finds next token.
Definition: message.c:642
int vlc_http_msg_add_agent(struct vlc_http_msg *m, const char *str)
Sets the agent field.
Definition: message.c:783
int vlc_memstream_close(struct vlc_memstream *ms)
Closes a byte stream object.
Definition: memstream.c:120
static ssize_t vlc_http_stream_write(struct vlc_http_stream *s, const void *base, size_t length, bool eos)
Write message payload data.
Definition: message.h:401
int vlc_http_msg_add_header(struct vlc_http_msg *m, const char *name, const char *fmt,...)
Definition: message.c:144
int asprintf(char **, const char *,...)
HTTP stream callbacks.
Definition: message.h:357
struct vlc_h2_frame * vlc_http_msg_h2_frame(const struct vlc_http_msg *m, uint_fast32_t stream_id, bool eos)
Formats an HTTP 2.0 HEADER frame.
Definition: message.c:425
int vlc_http_msg_add_header(struct vlc_http_msg *, const char *name, const char *fmt,...) VLC_FORMAT(3
Formats a header field.
char * strndup(const char *, size_t)
int vlc_http_msg_add_atime(struct vlc_http_msg *m)
Adds a Date header field.
Definition: message.c:826
time_t vlc_http_msg_get_atime(const struct vlc_http_msg *m)
Gets message date.
Definition: message.c:872
bool vlc_http_cookies_store(vlc_http_cookie_jar_t *p_jar, const char *cookies, const char *host, const char *path)
Parse a value of an incoming Set-Cookie header and append the cookie to the cookie jar if appropriate...
Definition: httpcookies.c:296
struct vlc_http_stream * payload
Definition: message.c:69
void vlc_http_msg_get_cookies(const struct vlc_http_msg *m, vlc_http_cookie_jar_t *jar, const char *host, const char *path)
Definition: message.c:934
static const char vlc_http_days[7][4]
Definition: message.c:803
const char * vlc_http_msg_get_agent(const struct vlc_http_msg *m)
Gets the agent field.
Definition: message.c:795
block_t * p_next
Definition: vlc_block.h:119
int vlc_memstream_printf(struct vlc_memstream *ms, const char *fmt,...)
Appends a formatted string to a byte stream.
Definition: memstream.c:194
const char * vlc_http_msg_get_scheme(const struct vlc_http_msg *m)
Gets request scheme.
Definition: message.c:178
FILE * stream
Definition: vlc_memstream.h:45
struct vlc_http_msg * vlc_http_msg_get_initial(struct vlc_http_stream *s)
Definition: message.c:276
struct vlc_http_msg * vlc_http_req_create(const char *method, const char *scheme, const char *authority, const char *path)
Creates an HTTP request.
Definition: message.c:213
char * scheme
Definition: message.c:64
struct vlc_http_msg * vlc_http_msg_get_final(struct vlc_http_msg *m)
Gets final response headers.
Definition: message.c:284
static time_t vlc_http_mktime(const char *str)
Definition: message.c:834
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.
Definition: message.c:709
char * vlc_b64_encode_binary(const void *src, size_t length)
Base64 encoding.
Definition: strings.c:360
short status
Definition: message.c:62
static const char vlc_http_months[12][4]
Definition: message.c:806
ssize_t(* write)(struct vlc_http_stream *, const void *, size_t, bool eos)
Definition: message.h:360
#define VLC_H2_DEFAULT_MAX_FRAME
Definition: h2frame.h:98
static bool vlc_http_is_token(const char *)
Definition: message.c:636
char *(* headers)[2]
Definition: message.c:67
Definition: vlc_fixups.h:136
struct vlc_http_msg * vlc_http_msg_headers(const char *msg) VLC_USED
Parses an HTTP 1.1 message header.
Definition: message.c:366
HTTP stream.
Definition: message.h:366
void *const vlc_http_error
Error pointer value.
Definition: message.c:57
#define VLC_FORMAT(x, y)
String format function annotation.
Definition: vlc_common.h:141
time_t vlc_http_msg_get_time(const struct vlc_http_msg *m, const char *name)
Parses a timestamp header field.
Definition: message.c:864
void(* close)(struct vlc_http_stream *, bool abort)
Definition: message.h:362
Definition: httpcookies.c:265
struct vlc_http_msg * vlc_http_msg_headers(const char *msg)
Parses an HTTP 1.1 message header.
Definition: message.c:366
const char * vlc_http_msg_get_authority(const struct vlc_http_msg *m)
Gets request authority.
Definition: message.c:183
void vlc_http_msg_attach(struct vlc_http_msg *m, struct vlc_http_stream *s)
Definition: message.c:259
static char * vlc_http_get_token_value(const char *value, const char *token)
Definition: message.c:668
char * strdup(const char *)
static int vlc_http_msg_vadd_header(struct vlc_http_msg *m, const char *name, const char *fmt, va_list ap)
Definition: message.c:70
#define VLC_USED
Definition: fourcc_gen.c:32
const char name[16]
Definition: httpd.c:1268
char * method
Definition: message.c:63
char * path
Definition: message.c:66
struct vlc_http_msg * vlc_http_resp_create(unsigned status)
Creates an HTTP response.
Definition: message.c:241
struct block_t *(* read)(struct vlc_http_stream *)
Definition: message.h:361
time_t vlc_http_msg_get_mtime(const struct vlc_http_msg *m)
Gets resource date.
Definition: message.c:877
struct vlc_h2_frame * vlc_h2_frame_headers(uint_fast32_t stream_id, uint_fast32_t mtu, bool eos, unsigned count, const char *const headers[][2])
Definition: h2frame.c:155
time_t timegm(struct tm *)
static bool vlc_http_is_agent(const char *s)
Definition: message.c:745
const char * vlc_http_msg_get_header(const struct vlc_http_msg *m, const char *name)
Looks up an header field.
Definition: message.c:156
int vlc_http_msg_get_status(const struct vlc_http_msg *m)
Gets response status code.
Definition: message.c:168
uint8_t * p_buffer
Payload start.
Definition: vlc_block.h:121
block_t * vlc_http_msg_read(struct vlc_http_msg *m)
Receives HTTP data.
Definition: message.c:291
int vlc_http_msg_add_time(struct vlc_http_msg *m, const char *hname, const time_t *t)
Adds a timestamp header field.
Definition: message.c:811
static ssize_t vlc_http_msg_find_header(const struct vlc_http_msg *m, const char *name)
Definition: message.c:61
static void * vlc_alloc(size_t count, size_t size)
Definition: vlc_common.h:1144
uintmax_t vlc_http_msg_get_size(const struct vlc_http_msg *m)
Gets HTTP payload length.
Definition: message.c:905
void block_Release(block_t *block)
Releases a block.
Definition: block.c:135
char * authority
Definition: message.c:65
Definition: vlc_block.h:117
int vasprintf(char **, const char *, va_list)
static int vlc_http_isctext(int c)
Definition: message.c:593
int vlc_http_msg_write(struct vlc_http_msg *m, block_t *block, bool eos)
Sends HTTP data.
Definition: message.c:299
int vlc_http_msg_add_cookies(struct vlc_http_msg *m, vlc_http_cookie_jar_t *jar)
Definition: message.c:946
static void vlc_http_stream_close(struct vlc_http_stream *s, bool abort)
Closes an HTTP stream.
Definition: message.h:428