Main Page   Modules   Data Structures   File List   Data Fields   Globals   Related Pages  

Cookies (request and response)
[libapreq2]


Data Structures

struct  apreq_cookie_t
struct  apreq_jar_t

Defines

#define APREQ_COOKIE_VERSION   NETSCAPE
#define APREQ_COOKIE_LENGTH   4096
#define apreq_value_to_cookie(ptr)
#define apreq_cookie_name(c)   ((c)->v.name)
#define apreq_cookie_value(c)   ((c)->v.data)
#define apreq_jar_items(j)   apr_table_elts(j->cookies)->nelts
#define apreq_jar_nelts(j)   apr_table_elts(j->cookies)->nelts

Typedefs

typedef apreq_jar_t apreq_jar_t
typedef apreq_cookie_t apreq_cookie_t

Enumerations

enum  apreq_cookie_version_t { NETSCAPE, RFC }

Functions

apreq_cookie_tapreq_cookie (const apreq_jar_t *jar, const char *name)
void apreq_add_cookie (apreq_jar_t *jar, const apreq_cookie_t *c)
apreq_jar_tapreq_jar (void *env, const char *hdr)
apreq_cookie_tapreq_make_cookie (apr_pool_t *p, const char *name, const apr_size_t nlen, const char *value, const apr_size_t vlen)
apr_status_t apreq_cookie_attr (apr_pool_t *p, apreq_cookie_t *c, const char *attr, apr_size_t alen, const char *val, apr_size_t vlen)
char * apreq_cookie_as_string (apr_pool_t *p, const apreq_cookie_t *c)
int apreq_serialize_cookie (char *buf, apr_size_t len, const apreq_cookie_t *c)
void apreq_cookie_expires (apreq_cookie_t *c, const char *time_str)
apr_status_t apreq_cookie_bake (const apreq_cookie_t *c, void *env)
apr_status_t apreq_cookie_bake2 (const apreq_cookie_t *c, void *env)
apreq_cookie_version_t apreq_ua_cookie_version (void *env)

Define Documentation

#define apreq_value_to_cookie ptr   ) 
 

Value:

apreq_attr_to_type(apreq_cookie_t, \
                                                      v, ptr)


Typedef Documentation

typedef struct apreq_cookie_t apreq_cookie_t
 

cookie XXX ...

typedef struct apreq_jar_t apreq_jar_t
 

Cookie Jar


Function Documentation

void apreq_add_cookie apreq_jar_t jar,
const apreq_cookie_t c
 

Adds a cookie by pushing it to the bottom of the jar.

Parameters:
jar The cookie jar.
c The cookie to add.

apreq_cookie_t* apreq_cookie const apreq_jar_t jar,
const char *  name
 

Fetches a cookie from the jar

Parameters:
jar The cookie jar.
name The name of the desired cookie.

char* apreq_cookie_as_string apr_pool_t p,
const apreq_cookie_t c
 

Returns a string that represents the cookie as it would appear in a valid "Set-Cookie*" header.

Parameters:
c The cookie.
p The pool.

apr_status_t apreq_cookie_attr apr_pool_t p,
apreq_cookie_t c,
const char *  attr,
apr_size_t  alen,
const char *  val,
apr_size_t  vlen
 

Sets the associated cookie attribute.

Parameters:
p Pool for allocating the new attribute.
c Cookie.
attr Name of attribute- leading '-' or '$' characters are ignored.
alen Length of attr.
val Value of new attribute.
vlen Length of new attribute.
Remarks:
Ensures cookie version & time are kept in sync.

apr_status_t apreq_cookie_bake const apreq_cookie_t c,
void *  env
 

Add the cookie to the outgoing "Set-Cookie" headers.

Parameters:
c The cookie.

apr_status_t apreq_cookie_bake2 const apreq_cookie_t c,
void *  env
 

Add the cookie to the outgoing "Set-Cookie2" headers.

Parameters:
c The cookie.

void apreq_cookie_expires apreq_cookie_t c,
const char *  time_str
 

Get/set the "expires" string. For NETSCAPE cookies, this returns the date (properly formatted) when the cookie is to expire. For RFC cookies, this function returns NULL.

Parameters:
c The cookie.
time_str If NULL, return the current expiry date. Otherwise replace with this value instead. The time_str should be in a format that apreq_atoi64t() can understand, namely /[+-]?+*[YMDhms]/.

apreq_jar_t* apreq_jar void *  env,
const char *  hdr
 

Parse the incoming "Cookie:" headers into a cookie jar.

Parameters:
env The current environment.
hdr String to parse as a HTTP-merged "Cookie" header.
Remarks:
"data = NULL" has special behavior. In this case, apreq_jar(env,NULL) will attempt to fetch a cached object from the environment via apreq_env_jar. Failing that, it will replace "hdr" with the result of apreq_env_cookie(env), parse that, and store the resulting object back within the environment. This maneuver is designed to mimimize parsing work, since generating the cookie jar is relatively expensive.

apreq_cookie_t* apreq_make_cookie apr_pool_t pool,
const char *  name,
const apr_size_t  nlen,
const char *  value,
const apr_size_t  vlen
 

Returns a new cookie, made from the argument list. The cookie is allocated from the ctx pool.

Parameters:
ctx The current context.
name The cookie's name.
nlen Length of name.
value The cookie's value.
vlen Length of value.

int apreq_serialize_cookie char *  buf,
apr_size_t  len,
const apreq_cookie_t c
 

Same functionality as apreq_cookie_as_string. Stores the string representation in buf, using up to len bytes in buf as storage. The return value has the same semantics as that of apr_snprintf, including the special behavior for a "len = 0" argument.

Parameters:
c The cookie.
buf Storage location for the result.
len Size of buf's storage area.


Generated on Sat Nov 15 23:04:50 2003 for libapreq2 by doxygen1.3