Cookies

## Functions

int | ulfius_add_cookie_to_response (struct _u_response *response, const char *key, const char *value, const char *expires, const unsigned int max_age, const char *domain, const char *path, const int secure, const int http_only)
int | ulfius_add_same_site_cookie_to_response (struct _u_response *response, const char *key, const char *value, const char *expires, const unsigned int max_age, const char *domain, const char *path, const int secure, const int http_only, const int same_site)

## Detailed Description

Cookies management functions

## Function Documentation

## ulfius_add_cookie_to_response()

int ulfius_add_cookie_to_response | ( | struct _u_response * | response,
|  | const char * | key,
|  | const char * | value,
|  | const char * | expires,
|  | const unsigned int | max_age,
|  | const char * | domain,
|  | const char * | path,
|  | const int | secure,
|  | const int | http_only
| ) |  |

ulfius_add_cookie_to_response add a cookie to the cookie map

Parameters

  response | the response to add the cookie to
  key | the cookie key
  value | the cookie value
  expires | the expiration date of the ccokie in ISO format (optional)
  max_age | the maximum age of the cookie in seconds (optional)
  domain | the domain of the cookie (optional)
  path | the path of the cookie (optional)
  secure | wether the cookie must be secure or not (optional)
  http_only | wether the cookie must be used only for http requests or not (optional)

Returns
  U_OK on success

## ulfius_add_same_site_cookie_to_response()

int ulfius_add_same_site_cookie_to_response | ( | struct _u_response * | response,
|  | const char * | key,
|  | const char * | value,
|  | const char * | expires,
|  | const unsigned int | max_age,
|  | const char * | domain,
|  | const char * | path,
|  | const int | secure,
|  | const int | http_only,
|  | const int | same_site
| ) |  |

ulfius_add_same_site_cookie_to_response add a cookie to the cookie map with a SameSite attribute

Parameters

  response | the response to add the cookie to
  key | the cookie key
  value | the cookie value
  expires | the expiration date of the ccokie in ISO format (optional)
  max_age | the maximum age of the cookie in seconds (optional)
  domain | the domain of the cookie (optional)
  path | the path of the cookie (optional)
  secure | wether the cookie must be secure or not (optional)
  http_only | wether the cookie must be used only for http requests or not (optional)

  same_site

  parameter must have one of the following values:
  - U_COOKIE_SAME_SITE_NONE - No SameSite attribute
  - U_COOKIE_SAME_SITE_STRICT - SameSite attribute set to 'Strict'
  - U_COOKIE_SAME_SITE_LAX - SameSite attribute set to 'Lax'

Returns
  U_OK on success