Apache HTTPD
Classes | Macros | Functions

Classes

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,...)
 
apr_status_t ap_cookie_write2 (request_rec *r, const char *name2, const char *val, const char *attrs2, long maxage,...)
 
apr_status_t ap_cookie_remove (request_rec *r, const char *name, const char *attrs,...)
 
apr_status_t ap_cookie_remove2 (request_rec *r, const char *name2, const char *attrs2,...)
 
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"

Definition at line 46 of file util_cookies.h.

◆ DEFAULT_ATTRS

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

Definition at line 45 of file util_cookies.h.

◆ SET_COOKIE

#define SET_COOKIE   "Set-Cookie"

Definition at line 43 of file util_cookies.h.

◆ SET_COOKIE2

#define SET_COOKIE2   "Set-Cookie2"

Definition at line 44 of file util_cookies.h.

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.

Definition at line 283 of file util_cookies.c.

◆ 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.

Definition at line 245 of file util_cookies.c.

◆ 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.

Remove an RFC2109 compliant cookie.

Parameters
rThe request
nameThe name of the cookie.

Definition at line 120 of file util_cookies.c.

◆ 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.

Remove an RFC2965 compliant cookie.

Parameters
rThe request
name2The name of the cookie.

Definition at line 148 of file util_cookies.c.

◆ 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.

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.

Definition at line 40 of file util_cookies.c.

◆ 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.

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.

Definition at line 82 of file util_cookies.c.