HTTP cookie as defined in RFC 2109. More...
#include <httpcookie.h>
Public Member Functions | |
HttpCookie () | |
Creates an empty cookie. | |
HttpCookie (const QByteArray name, const QByteArray value, const int maxAge, const QByteArray path="/", const QByteArray comment=QByteArray(), const QByteArray domain=QByteArray(), const bool secure=false) | |
Create a cookie and set name/value pair. | |
HttpCookie (const QByteArray source) | |
Create a cookie from a string. | |
QByteArray | toByteArray () const |
Convert this cookie to a string that may be used in a Set-Cookie2 header. | |
void | setName (const QByteArray name) |
Set the name of this cookie. | |
void | setValue (const QByteArray value) |
Set the value of this cookie. | |
void | setComment (const QByteArray comment) |
Set the comment of this cookie. | |
void | setDomain (const QByteArray domain) |
Set the domain of this cookie. | |
void | setMaxAge (const int maxAge) |
Set the maximum age of this cookie in seconds. | |
void | setPath (const QByteArray path) |
Set the path for that the cookie will be sent, default="/" which means the whole domain. | |
void | setSecure (const bool secure) |
Set secure mode, so that the cokkie will only be sent on secure connections. | |
QByteArray | getName () const |
Get the name of this cookie. | |
QByteArray | getValue () const |
Get the value of this cookie. | |
QByteArray | getComment () const |
Get the comment of this cookie. | |
QByteArray | getDomain () const |
Get the domain of this cookie. | |
int | getMaxAge () const |
Set the maximum age of this cookie in seconds. | |
QByteArray | getPath () const |
Set the path of this cookie. | |
bool | getSecure () const |
Get the secure flag of this cookie. | |
int | getVersion () const |
Returns always 1. | |
Static Public Member Functions | |
static QList< QByteArray > | splitCSV (const QByteArray source) |
Split a string list into parts, where each part is delimited by semicolon. |
HTTP cookie as defined in RFC 2109.
This class can also parse RFC 2965 cookies, but skips fields that are not defined in RFC 2109.
Definition at line 18 of file httpcookie.h.
HttpCookie::HttpCookie | ( | const QByteArray | name, | |
const QByteArray | value, | |||
const int | maxAge, | |||
const QByteArray | path = "/" , |
|||
const QByteArray | comment = QByteArray() , |
|||
const QByteArray | domain = QByteArray() , |
|||
const bool | secure = false | |||
) |
Create a cookie and set name/value pair.
name | name of the cookie | |
value | value of the cookie | |
maxAge | maximum age of the cookie in seconds. 0=discard immediately | |
path | Path for that the cookie will be sent, default="/" which means the whole domain | |
comment | Optional comment, may be displayed by the web browser somewhere | |
domain | Optional domain for that the cookie will be sent. Defaults to the current domain | |
secure | If true, the cookie will only be sent on secure connections |
Definition at line 14 of file httpcookie.cpp.
HttpCookie::HttpCookie | ( | const QByteArray | source | ) |
Create a cookie from a string.
source | String as received in a HTTP Cookie2 header. |
Definition at line 25 of file httpcookie.cpp.
int HttpCookie::getMaxAge | ( | ) | const |
Set the maximum age of this cookie in seconds.
Definition at line 148 of file httpcookie.cpp.
void HttpCookie::setMaxAge | ( | const int | maxAge | ) |
Set the maximum age of this cookie in seconds.
0=discard immediately
Definition at line 120 of file httpcookie.cpp.
QList< QByteArray > HttpCookie::splitCSV | ( | const QByteArray | source | ) | [static] |
Split a string list into parts, where each part is delimited by semicolon.
Semicolons within double quotes are skipped. Double quotes are removed.
Definition at line 164 of file httpcookie.cpp.
QByteArray HttpCookie::toByteArray | ( | ) | const |
Convert this cookie to a string that may be used in a Set-Cookie2 header.
Definition at line 76 of file httpcookie.cpp.