VLC 4.0.0-dev
Loading...
Searching...
No Matches
httpcookies.c File Reference
Include dependency graph for httpcookies.c:

Data Structures

struct  http_cookie_t
 
struct  vlc_http_cookie_jar_t
 

Typedefs

typedef struct http_cookie_t http_cookie_t
 

Functions

static char * cookie_get_attribute_value (const char *cookie, const char *attr)
 
static bool cookie_has_attribute (const char *cookie, const char *attr)
 
static char * cookie_get_domain (const char *cookie)
 
static bool cookie_domain_matches (const http_cookie_t *cookie, const char *host)
 
static char * cookie_get_path (const char *cookie)
 
static bool cookie_path_matches (const http_cookie_t *cookie, const char *uripath)
 
static bool cookie_should_be_sent (const http_cookie_t *cookie, bool secure, const char *host, const char *path)
 
static char * cookie_default_path (const char *request_path)
 
static void cookie_destroy (http_cookie_t *cookie)
 
static http_cookie_tcookie_parse (const char *value, const char *host, const char *path)
 
vlc_http_cookie_jar_tvlc_http_cookies_new (void)
 
void vlc_http_cookies_destroy (vlc_http_cookie_jar_t *p_jar)
 
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.
 
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.
 

Typedef Documentation

◆ http_cookie_t

typedef struct http_cookie_t http_cookie_t

Function Documentation

◆ cookie_default_path()

static char * cookie_default_path ( const char *  request_path)
static

References strdup(), and strndup().

Referenced by cookie_parse().

◆ cookie_destroy()

◆ cookie_domain_matches()

static bool cookie_domain_matches ( const http_cookie_t cookie,
const char *  host 
)
static

◆ cookie_get_attribute_value()

static char * cookie_get_attribute_value ( const char *  cookie,
const char *  attr 
)
static

◆ cookie_get_domain()

static char * cookie_get_domain ( const char *  cookie)
static

References cookie_get_attribute_value().

Referenced by cookie_parse().

◆ cookie_get_path()

static char * cookie_get_path ( const char *  cookie)
static

References cookie_get_attribute_value().

Referenced by cookie_parse().

◆ cookie_has_attribute()

static bool cookie_has_attribute ( const char *  cookie,
const char *  attr 
)
static

References vlc_ascii_strncasecmp().

Referenced by cookie_parse().

◆ cookie_parse()

◆ cookie_path_matches()

static bool cookie_path_matches ( const http_cookie_t cookie,
const char *  uripath 
)
static

◆ cookie_should_be_sent()

static bool cookie_should_be_sent ( const http_cookie_t cookie,
bool  secure,
const char *  host,
const char *  path 
)
static

◆ vlc_http_cookies_destroy()

◆ vlc_http_cookies_fetch()

char * vlc_http_cookies_fetch ( vlc_http_cookie_jar_t jar,
bool  secure,
const char *  host,
const char *  path 
)

Returns a cookie value that match the given URL.

Parameters
jara cookie jar
securewhether a secure connection will be used or not
hostthe hostname for which the cookie was stored
paththe cookie name to fetch
Returns
A string consisting of semicolon-separated cookie NAME=VALUE pairs.

References asprintf(), cookie_should_be_sent(), vlc_http_cookie_jar_t::cookies, vlc_http_cookie_jar_t::lock, http_cookie_t::psz_name, http_cookie_t::psz_value, vlc_array_count(), vlc_array_item_at_index, vlc_mutex_lock(), and vlc_mutex_unlock().

Referenced by vlc_http_msg_add_cookies().

◆ vlc_http_cookies_new()

◆ vlc_http_cookies_store()

bool vlc_http_cookies_store ( vlc_http_cookie_jar_t jar,
const char *  cookie,
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.

Parameters
jarcookie jar object
cookieheader field value of Set-Cookie
hostthe hostname to store the cookie for
paththe name of the cookie to store
Returns
true, if the cookie was added, false otherwise

References cookie_destroy(), cookie_domain_matches(), cookie_parse(), vlc_http_cookie_jar_t::cookies, vlc_http_cookie_jar_t::lock, http_cookie_t::psz_domain, http_cookie_t::psz_name, http_cookie_t::psz_path, vlc_array_append(), vlc_array_count(), vlc_array_item_at_index, vlc_array_remove(), vlc_ascii_strcasecmp(), vlc_mutex_lock(), and vlc_mutex_unlock().

Referenced by vlc_http_msg_get_cookies().