Apache2
Collaboration diagram for Cookies:

Data Structures

struct  ap_cookie_do
 

Macros

#define SET_COOKIE   "Set-Cookie"
 
#define SET_COOKIE2   "Set-Cookie2"
 
#define DEFAULT_ATTRS   "HttpOnly;Secure;Version=1"
 
#define CLEAR_ATTRS   "Version=1"
 

Functions

apr_status_t ap_cookie_write (request_rec *r, const char *name, const char *val, const char *attrs, long maxage,...) AP_FN_ATTR_SENTINEL
 
apr_status_t ap_cookie_write2 (request_rec *r, const char *name2, const char *val, const char *attrs2, long maxage,...) AP_FN_ATTR_SENTINEL
 
apr_status_t ap_cookie_remove (request_rec *r, const char *name, const char *attrs,...) AP_FN_ATTR_SENTINEL
 
apr_status_t ap_cookie_remove2 (request_rec *r, const char *name2, const char *attrs2,...) AP_FN_ATTR_SENTINEL
 
apr_status_t ap_cookie_read (request_rec *r, const char *name, const char **val, int remove)
 
apr_status_t ap_cookie_check_string (const char *string)
 

Detailed Description

RFC2109 and RFC2965 compliant HTTP cookies can be read from and written to using this set of functions.

Macro Definition Documentation

◆ CLEAR_ATTRS

#define CLEAR_ATTRS   "Version=1"

◆ DEFAULT_ATTRS

#define DEFAULT_ATTRS   "HttpOnly;Secure;Version=1"

◆ SET_COOKIE

#define SET_COOKIE   "Set-Cookie"

◆ SET_COOKIE2

#define SET_COOKIE2   "Set-Cookie2"

Function Documentation

◆ ap_cookie_check_string()

apr_status_t ap_cookie_check_string ( const char *  string)

Sanity check a given string that it exists, is not empty, and does not contain the special characters '=', ';' and '&'.

It is used to sanity check the cookie names.

◆ ap_cookie_read()

apr_status_t ap_cookie_read ( request_rec r,
const char *  name,
const char **  val,
int  remove 
)

Read a cookie called name, placing its value in val.

Both the Cookie and Cookie2 headers are scanned for the cookie.

If the cookie is duplicated, this function returns APR_EGENERAL. If found, and if remove is non zero, the cookie will be removed from the headers, and thus kept private from the backend.

◆ ap_cookie_remove()

apr_status_t ap_cookie_remove ( request_rec r,
const char *  name,
const char *  attrs,
  ... 
)

Remove an RFC2109 compliant cookie.

Parameters
rThe request
nameThe name of the cookie.
attrsThe string containing additional cookie attributes. If NULL, the CLEAR_ATTRS will be used.
...A varargs array of zero or more (apr_table_t *) tables followed by NULL to which the cookies should be added.

◆ ap_cookie_remove2()

apr_status_t ap_cookie_remove2 ( request_rec r,
const char *  name2,
const char *  attrs2,
  ... 
)

Remove an RFC2965 compliant cookie.

Parameters
rThe request
name2The name of the cookie.
attrs2The string containing additional cookie attributes. If NULL, the CLEAR_ATTRS will be used.
...A varargs array of zero or more (apr_table_t *) tables followed by NULL to which the cookies should be added.

◆ ap_cookie_write()

apr_status_t ap_cookie_write ( request_rec r,
const char *  name,
const char *  val,
const char *  attrs,
long  maxage,
  ... 
)

Write an RFC2109 compliant cookie.

Parameters
rThe request
nameThe name of the cookie.
valThe value to place in the cookie.
attrsThe string containing additional cookie attributes. If NULL, the DEFAULT_ATTRS will be used.
maxageIf non zero, a Max-Age header will be added to the cookie.
...A varargs array of zero or more (apr_table_t *) tables followed by NULL to which the cookies should be added.

◆ ap_cookie_write2()

apr_status_t ap_cookie_write2 ( request_rec r,
const char *  name2,
const char *  val,
const char *  attrs2,
long  maxage,
  ... 
)

Write an RFC2965 compliant cookie.

Parameters
rThe request
name2The name of the cookie.
valThe value to place in the cookie.
attrs2The string containing additional cookie attributes. If NULL, the DEFAULT_ATTRS will be used.
maxageIf non zero, a Max-Age header will be added to the cookie.
...A varargs array of zero or more (apr_table_t *) tables followed by NULL to which the cookies should be added.