restcgi::cookie Class Reference

List of all members.

Detailed Description

HTTP cookie as a name, value, and attributes.

When creating a cookie (responses) the name is forced to be a strict HTTP "token" and value a HTTP "word". This is relaxed on parsing as browsers and JavaScripts have different formats.

Follows RFC2109 standard. Here are the differences between Netscape, RFC2109, and RFC2965:

  1. Netscape allows only 1 n-v pair per Set-Cookie (multiple hdr lines), RFCs allow many (1 hdr line).
  2. Netscape Set-Cookie has "expires", RFCs "Max-Age". Note that "expires" date is not quoted.
  3. Netscape Cookie separates n-v pairs with semi-colons, RFCs with commas (although it advises to accept both).
  4. Netscape does not send attributes with Cookie, RFCs do.
  5. RFC2109 uses "Set-Cookie" and "Cookie", RFC2965 "Set-Cookie2" and "Cookie2".
  6. Other attribute differences.
See also:
cookies, cookie_attrs

http://wp.netscape.com/newsref/std/cookie_spec.html

http://tools.ietf.org/html/rfc2109

http://tools.ietf.org/html/rfc2965


Public Types

typedef restcgi::cookie_attrs attrs_type
 cookie attrs type

Public Member Functions

 cookie ()
 cookie (const http_token &name, const http_word &value, const attrs_type &attrs=attrs_type())
 Construct.
 cookie (const std::string &name, const std::string &value, const attrs_type &attrs=attrs_type())
bool is_null () const
 Test if null.
const std::string & name () const
template<typename T>
value () const
const attrs_typeattrs () const
 Get attrs.
const std::string & id () const
std::ostream & operator<< (std::ostream &os) const
 Stream out in HTTP header format.


Constructor & Destructor Documentation

restcgi::cookie::cookie (  ) 

Construct null.

restcgi::cookie::cookie ( const std::string &  name,
const std::string &  value,
const attrs_type attrs = attrs_type() 
)

Construct.

Exceptions:
std::invalid_argument if name or value are not valid


Member Function Documentation

const std::string& restcgi::cookie::id (  )  const [inline]

Get id made up of name:domain:path.

const std::string& restcgi::cookie::name (  )  const [inline]

Get name.

template<typename T>
T restcgi::cookie::value (  )  const [inline]

Get converted, unencoded value.

Exceptions:
bad_request on conversion error


Generated on Fri May 15 11:27:12 2009 for restcgi by  doxygen 1.4.7