Panda3D
Loading...
Searching...
No Matches
Public Member Functions | Public Attributes | List of all members
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...

#include <pandadoc.hpp>

Public Member Functions

 __init__ ()
 Constructs an empty cookie.
 
 __init__ (const HTTPCookie)
 
 __init__ (str format, const URLSpec url)
 Constructs a cookie according to the indicated string, presumably the tag of a Set-Cookie header.
 
 __init__ (str name, str path, str domain)
 Constructs a cookie with the indicated name, path, and domain values, but no other data.
 
 clearExpires ()
 Removes the expiration date on the cookie.
 
str getDomain ()
 
HTTPDate getExpires ()
 Returns the expiration date of the cookie if it is set, or an invalid date if it is not.
 
str getName ()
 Returns the name of the cookie.
 
str 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.
 
str getValue ()
 Returns the value of the cookie.
 
bool hasExpires ()
 Returns true if the cookie has an expiration date, false otherwise.
 
bool isExpired (const HTTPDate now)
 Returns true if the cookie's expiration date is before the indicated date, false otherwise.
 
bool matchesUrl (const URLSpec url)
 Returns true if the cookie is appropriate to send with the indicated URL request, false otherwise.
 
bool operator< (const HTTPCookie other)
 
 output (Ostream out)
 
bool parseSetCookie (str format, const URLSpec url)
 Separates out the parameter/value pairs of the Set-Cookie header and assigns the values of the cookie appropriate.
 
 setDomain (str domain)
 
 setExpires (const HTTPDate expires)
 
 setName (str name)
 
 setPath (str path)
 
 setSecure (bool flag)
 
 setValue (str value)
 
 updateFrom (const HTTPCookie 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.
 

Public Attributes

const String domain
 
HTTPDate expires
 Returns the expiration date of the cookie if it is set, or an invalid date if it is not.
 
const String name
 Returns the name of the cookie.
 
const String path
 Returns the prefix of the URL paths on the server for which this cookie will be sent.
 
bool secure
 Returns true if the server has indicated this is a "secure" cookie which should only be sent over an HTTPS channel.
 
const String value
 Returns the value of the 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.

Member Function Documentation

◆ __init__() [1/4]

__init__ ( )

Constructs an empty cookie.

◆ __init__() [2/4]

__init__ ( const HTTPCookie )

◆ __init__() [3/4]

__init__ ( str format,
const URLSpec 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.

◆ __init__() [4/4]

__init__ ( str name,
str path,
str 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.

◆ clearExpires()

clearExpires ( )

Removes the expiration date on the cookie.

◆ getDomain()

str getDomain ( )

◆ getExpires()

HTTPDate getExpires ( )

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

◆ getName()

str getName ( )

Returns the name of the cookie.

This is the key value specified by the server.

◆ getPath()

str getPath ( )

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

◆ getSecure()

bool getSecure ( )

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

◆ getValue()

str getValue ( )

Returns the value of the cookie.

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

◆ hasExpires()

bool hasExpires ( )

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

◆ isExpired()

bool isExpired ( const HTTPDate now)

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

◆ matchesUrl()

bool matchesUrl ( const URLSpec url)

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

◆ operator<()

bool operator< ( const HTTPCookie other)

◆ output()

output ( Ostream out)

◆ parseSetCookie()

bool parseSetCookie ( str format,
const URLSpec 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()

setDomain ( str domain)

◆ setExpires()

setExpires ( const HTTPDate expires)

◆ setName()

setName ( str name)

◆ setPath()

setPath ( str path)

◆ setSecure()

setSecure ( bool flag)

◆ setValue()

setValue ( str value)

◆ updateFrom()

updateFrom ( const HTTPCookie 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.

Member Data Documentation

◆ domain

const String domain

◆ expires

HTTPDate expires

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

◆ name

const String name

Returns the name of the cookie.

This is the key value specified by the server.

◆ path

const String path

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

◆ secure

bool secure

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

◆ value

const String value

Returns the value of the cookie.

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