libfetch 0.0.0
A lightweight asynchronous HTTP/1.1 client library implementing a subset of the WHATWG Fetch API.
Loading...
Searching...
No Matches
Cookie Inspection

Check cookie properties and states. More...

Functions

bool cookie_is_secure (const cookie_t *cookie)
 Check if cookie has Secure flag.
 
bool cookie_is_http_only (const cookie_t *cookie)
 Check if cookie has HttpOnly flag.
 
bool cookie_is_session (const cookie_t *cookie)
 Check if cookie is a session cookie.
 
bool cookie_is_expired (const cookie_t *cookie, time_t current_time)
 Check if cookie is expired.
 
bool cookie_is_host_only (const cookie_t *cookie)
 Check if cookie is host-only.
 
cookie_samesite_t cookie_get_samesite (const cookie_t *cookie)
 Get cookie's SameSite attribute.
 
cookie_priority_t cookie_get_priority (const cookie_t *cookie)
 Get cookie's priority.
 
void cookie_touch (cookie_t *cookie)
 Update cookie's last access time.
 

Detailed Description

Check cookie properties and states.

Function Documentation

◆ cookie_get_priority()

cookie_priority_t cookie_get_priority ( const cookie_t * cookie)

Get cookie's priority.

Parameters
cookieCookie to check
Returns
Priority level

◆ cookie_get_samesite()

cookie_samesite_t cookie_get_samesite ( const cookie_t * cookie)

Get cookie's SameSite attribute.

Parameters
cookieCookie to check
Returns
SameSite value

◆ cookie_is_expired()

bool cookie_is_expired ( const cookie_t * cookie,
time_t current_time )

Check if cookie is expired.

Parameters
cookieCookie to check
current_timeCurrent timestamp for comparison
Returns
True if cookie is expired
if (cookie_is_expired(cookie, time(NULL))) {
printf("Cookie has expired\n");
}
HTTP cookie structure.
Definition cookie.h:105

◆ cookie_is_host_only()

bool cookie_is_host_only ( const cookie_t * cookie)

Check if cookie is host-only.

Parameters
cookieCookie to check
Returns
True if cookie is restricted to exact host

◆ cookie_is_http_only()

bool cookie_is_http_only ( const cookie_t * cookie)

Check if cookie has HttpOnly flag.

Parameters
cookieCookie to check
Returns
True if cookie is HTTP-only

◆ cookie_is_secure()

bool cookie_is_secure ( const cookie_t * cookie)

Check if cookie has Secure flag.

Parameters
cookieCookie to check
Returns
True if cookie is secure

◆ cookie_is_session()

bool cookie_is_session ( const cookie_t * cookie)

Check if cookie is a session cookie.

Parameters
cookieCookie to check
Returns
True if cookie has no expiry time

◆ cookie_touch()

void cookie_touch ( cookie_t * cookie)

Update cookie's last access time.

Parameters
cookieCookie to touch

Call this when a cookie is used to track access patterns.