|
static char * | trim_whitespace (char *str) |
| Remove leading and trailing whitespace from a string.
|
|
static uint32_t | hash_domain (const char *domain) |
| Calculate FNV-1a hash for domain strings.
|
|
static time_t | parse_cookie_date (const char *date_str) |
| Parse cookie expiration date from various formats.
|
|
static cookie_domain_bucket_t * | find_domain_bucket (const cookie_jar_t *jar, const char *domain) |
| Find domain bucket in hash table.
|
|
static cookie_domain_bucket_t * | create_domain_bucket (cookie_jar_t *jar, const char *domain) |
| Create new domain bucket and add to hash table.
|
|
static bool | remove_cookie_from_bucket (cookie_domain_bucket_t *bucket, cookie_t *cookie) |
| Remove cookie from its domain bucket.
|
|
static bool | add_cookie_to_bucket (cookie_domain_bucket_t *bucket, cookie_t *cookie) |
| Add cookie to domain bucket.
|
|
static bool | validate_cookie_domain (const char *cookie_domain, const char *request_host) |
| Validate cookie domain against request host.
|
|
static bool | validate_cookie_prefix (const char *name, const cookie_t *cookie, bool is_secure_request) |
| Validate cookie name prefix security attributes.
|
|
static size_t | calculate_binary_size (const cookie_jar_t *jar, uint32_t *cookie_count) |
| Calculate total size needed for binary serialization.
|
|
static bool | serialize_to_buffer (const cookie_jar_t *jar, char *buffer, size_t buffer_size) |
| Serialize cookie jar to binary buffer.
|
|
static bool | deserialize_from_buffer (cookie_jar_t *jar, const char *buffer, size_t buffer_size) |
| Deserialize cookie jar from binary buffer.
|
|
bool | cookie_is_valid_name (const char *name) |
| Check if cookie name is valid.
|
|
bool | cookie_is_valid_value (const char *value) |
| Check if cookie value is valid.
|
|
cookie_jar_config_t | cookie_jar_default_config (void) |
| Get default cookie jar configuration.
|
|
cookie_jar_t * | cookie_jar_new (void) |
| Create a new cookie jar with default configuration.
|
|
cookie_jar_t * | cookie_jar_new_with_config (const cookie_jar_config_t *config) |
| Create a new cookie jar with custom configuration.
|
|
void | cookie_jar_free (cookie_jar_t *jar) |
| Free a cookie jar and all its cookies.
|
|
void | cookie_jar_clear (cookie_jar_t *jar) |
| Clear all cookies from a jar.
|
|
size_t | cookie_jar_count (const cookie_jar_t *jar) |
| Get total number of cookies in jar.
|
|
size_t | cookie_jar_count_for_domain (const cookie_jar_t *jar, const char *domain) |
| Get number of cookies for a specific domain.
|
|
cookie_t * | cookie_new (const char *name, const char *value, const char *domain, const char *path) |
| Create a new cookie.
|
|
cookie_t * | cookie_clone (const cookie_t *cookie) |
| Clone a cookie.
|
|
void | cookie_free (cookie_t *cookie) |
| Free a cookie.
|
|
void | cookie_set_expires (cookie_t *cookie, time_t expires) |
| Set cookie expiration time.
|
|
void | cookie_set_max_age (cookie_t *cookie, int64_t max_age_seconds) |
| Set cookie max-age.
|
|
void | cookie_set_secure (cookie_t *cookie, bool secure) |
| Set Secure flag.
|
|
void | cookie_set_http_only (cookie_t *cookie, bool http_only) |
| Set HttpOnly flag.
|
|
void | cookie_set_samesite (cookie_t *cookie, cookie_samesite_t samesite) |
| Set SameSite attribute.
|
|
void | cookie_set_priority (cookie_t *cookie, cookie_priority_t priority) |
| Set Priority attribute.
|
|
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.
|
|
bool | cookie_domain_matches (const char *cookie_domain, const char *request_domain) |
| Check if cookie domain matches request domain.
|
|
bool | cookie_path_matches (const char *cookie_path, const char *request_path) |
| Check if cookie path matches request path.
|
|
char * | cookie_canonicalize_domain (const char *domain) |
| Convert domain to canonical lowercase form.
|
|
char * | cookie_default_path (const char *url) |
| Extract default path from URL.
|
|
bool | cookie_is_public_suffix (const char *domain) |
| Check if domain is a public suffix.
|
|
cookie_parse_result_t | cookie_parse_set_cookie (const char *header_value, const char *request_url, cookie_t **cookie) |
| Parse a Set-Cookie header.
|
|
const char * | cookie_samesite_to_string (cookie_samesite_t samesite) |
| Convert SameSite enum to string.
|
|
cookie_samesite_t | cookie_samesite_from_string (const char *str) |
| Convert string to SameSite enum.
|
|
const char * | cookie_priority_to_string (cookie_priority_t priority) |
| Convert Priority enum to string.
|
|
cookie_priority_t | cookie_priority_from_string (const char *str) |
| Convert string to Priority enum.
|
|
const char * | cookie_parse_error_string (cookie_parse_result_t result) |
| Get error message for parse result.
|
|
bool | cookie_jar_add (cookie_jar_t *jar, cookie_t *cookie) |
| Add a cookie to a jar.
|
|
bool | cookie_jar_remove (cookie_jar_t *jar, const char *name, const char *domain, const char *path) |
| Remove a specific cookie from jar.
|
|
size_t | cookie_jar_remove_domain (cookie_jar_t *jar, const char *domain) |
| Remove all cookies for a domain.
|
|
size_t | cookie_jar_cleanup_expired (cookie_jar_t *jar) |
| Remove expired cookies from jar.
|
|
size_t | cookie_jar_remove_session (cookie_jar_t *jar) |
| Remove all session cookies from jar.
|
|
cookie_match_t * | cookie_jar_get_cookies_for_url (cookie_jar_t *jar, const char *url, bool include_http_only) |
| Get cookies that match a URL.
|
|
cookie_match_t * | cookie_jar_get_cookies (cookie_jar_t *jar, const char *domain, const char *path, bool secure_only, bool include_http_only) |
| Get cookies matching domain and path.
|
|
void | cookie_match_free (cookie_match_t *matches) |
| Free a list of cookie matches.
|
|
char * | cookie_match_to_header (const cookie_match_t *matches) |
| Convert cookie matches to HTTP Cookie header.
|
|
cookie_iterator_t | cookie_jar_iterator (cookie_jar_t *jar) |
| Create iterator for all cookies in jar.
|
|
cookie_iterator_t | cookie_jar_iterator_domain (cookie_jar_t *jar, const char *domain) |
| Create iterator for cookies in specific domain.
|
|
cookie_t * | cookie_iterator_next (cookie_iterator_t *iter) |
| Get next cookie from iterator.
|
|
bool | cookie_iterator_has_next (const cookie_iterator_t *iter) |
| Check if iterator has more cookies.
|
|
void | cookie_iterator_reset (cookie_iterator_t *iter) |
| Reset iterator to beginning.
|
|
bool | cookie_jar_save_binary (const cookie_jar_t *jar, const char *filename) |
| Save cookies to binary file.
|
|
bool | cookie_jar_load_binary (cookie_jar_t *jar, const char *filename) |
| Load cookies from binary file.
|
|
char * | cookie_jar_save_binary_buffer (const cookie_jar_t *jar, size_t *buffer_size) |
| Save cookies to memory buffer.
|
|
bool | cookie_jar_load_binary_buffer (cookie_jar_t *jar, const char *buffer, size_t buffer_size) |
| Load cookies from memory buffer.
|
|