Panda3D
 All Classes Namespaces Functions Variables Enumerations Enumerator Properties
Public Member Functions
HTTPCookie Class Reference

A cookie sent from an HTTP server to be stored on the client and returned when the path and/or domain matches. More...

List of all members.

Public Member Functions

 HTTPCookie ()
 Constructs an empty cookie.
 HTTPCookie (string format, URLSpec const url)
 Constructs a cookie according to the indicated string, presumably the tag of a Set-Cookie header.
 HTTPCookie (string name, string path, string domain)
 Constructs a cookie with the indicated name, path, and domain values, but no other data.
 clearExpires ()
 Removes the expiration date on the cookie.
string getDomain ()
HTTPDate getExpires ()
 Returns the expiration date of the cookie if it is set, or an invalid date if it is not.
string getName ()
 Returns the name of the cookie.
string getPath ()
 Returns the prefix of the URL paths on the server for which this cookie will be sent.
bool getSecure ()
 Returns true if the server has indicated this is a "secure" cookie which should only be sent over an HTTPS channel.
string getValue ()
 Returns the value of the cookie.
bool hasExpires ()
 Returns true if the cookie has an expiration date, false otherwise.
bool isExpired (HTTPDate const now)
 Returns true if the cookie's expiration date is before the indicated date, false otherwise.
bool isExpired ()
 Returns true if the cookie's expiration date is before the indicated date, false otherwise.
bool matchesUrl (URLSpec const url)
 Returns true if the cookie is appropriate to send with the indicated URL request, false otherwise.
bool operator< (HTTPCookie const other)
 The sorting operator allows the cookies to be stored in a single dictionary; it returns nonequal only if the cookies are different in name, path, or domain.
 output (ostream out)
bool parseSetCookie (string format, URLSpec const url)
 Separates out the parameter/value pairs of the Set-Cookie header and assigns the values of the cookie appropriate.
 setDomain (string domain)
 setExpires (HTTPDate const expires)
 setName (string name)
 setPath (string path)
 setSecure (bool flag)
 setValue (string value)
 updateFrom (HTTPCookie const other)
 Assuming the operator < method, above, has already evaluated these two cookies as equal, then assign the remaining values (value, expiration date, secure flag) from the indicated cookie.

Detailed Description

A cookie sent from an HTTP server to be stored on the client and returned when the path and/or domain matches.


Constructor & Destructor Documentation

Constructs an empty cookie.

HTTPCookie ( string  format,
URLSpec const  url 
)

Constructs a cookie according to the indicated string, presumably the tag of a Set-Cookie header.

There is no way to detect a formatting error in the string with this constructor.

HTTPCookie ( string  name,
string  path,
string  domain 
)

Constructs a cookie with the indicated name, path, and domain values, but no other data.

This is most useful for looking up an existing cookie in the HTTPClient.


Member Function Documentation

Removes the expiration date on the cookie.

string getDomain ( )

Returns the expiration date of the cookie if it is set, or an invalid date if it is not.

string getName ( )

Returns the name of the cookie.

This is the key value specified by the server.

string getPath ( )

Returns the prefix of the URL paths on the server for which this cookie will be sent.

bool getSecure ( )

Returns true if the server has indicated this is a "secure" cookie which should only be sent over an HTTPS channel.

string getValue ( )

Returns the value of the cookie.

This is the arbitrary string associated with the cookie's name, as specified by the server.

bool hasExpires ( )

Returns true if the cookie has an expiration date, false otherwise.

bool isExpired ( HTTPDate const  now)

Returns true if the cookie's expiration date is before the indicated date, false otherwise.

bool isExpired ( )

Returns true if the cookie's expiration date is before the indicated date, false otherwise.

bool matchesUrl ( URLSpec const  url)

Returns true if the cookie is appropriate to send with the indicated URL request, false otherwise.

bool operator< ( HTTPCookie const  other)

The sorting operator allows the cookies to be stored in a single dictionary; it returns nonequal only if the cookies are different in name, path, or domain.

output ( ostream  out)
bool parseSetCookie ( string  format,
URLSpec const  url 
)

Separates out the parameter/value pairs of the Set-Cookie header and assigns the values of the cookie appropriate.

Returns true if the header is parsed correctly, false if something is not understood.

setDomain ( string  domain)
setExpires ( HTTPDate const  expires)
setName ( string  name)
setPath ( string  path)
setSecure ( bool  flag)
setValue ( string  value)
updateFrom ( HTTPCookie const  other)

Assuming the operator < method, above, has already evaluated these two cookies as equal, then assign the remaining values (value, expiration date, secure flag) from the indicated cookie.

This is guaranteed not to change the ordering of the cookie in a set, and so can be used to update an existing cookie within a set with new values.

 All Classes Namespaces Functions Variables Enumerations Enumerator Properties