SDRAngel
4.11.5
Developer docs for <a href="https://github.com/f4exb/sdrangel">SDRangel<\a>, an Open Source Qt5 / OpenGL 3.0+ SDR and signal analyzer frontend to various hardware.
|
#include <httpcookie.h>
Public Member Functions | |
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, const bool httpOnly=false) | |
HttpCookie (const QByteArray source) | |
QByteArray | toByteArray () const |
void | setName (const QByteArray name) |
void | setValue (const QByteArray value) |
void | setComment (const QByteArray comment) |
void | setDomain (const QByteArray domain) |
void | setMaxAge (const int maxAge) |
void | setPath (const QByteArray path) |
void | setSecure (const bool secure) |
void | setHttpOnly (const bool httpOnly) |
QByteArray | getName () const |
QByteArray | getValue () const |
QByteArray | getComment () const |
QByteArray | getDomain () const |
int | getMaxAge () const |
QByteArray | getPath () const |
bool | getSecure () const |
bool | getHttpOnly () const |
int | getVersion () const |
Static Public Member Functions | |
static QList< QByteArray > | splitCSV (const QByteArray source) |
Private Attributes | |
QByteArray | name |
QByteArray | value |
QByteArray | comment |
QByteArray | domain |
int | maxAge |
QByteArray | path |
bool | secure |
bool | httpOnly |
int | version |
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 23 of file httpcookie.h.
HttpCookie::HttpCookie | ( | ) |
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 , |
||
const bool | httpOnly = 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 be sent by the browser to the server only on secure connections |
httpOnly | If true, the browser does not allow client-side scripts to access the cookie |
Definition at line 18 of file httpcookie.cpp.
References comment, domain, httpOnly, maxAge, name, path, secure, value, and version.
HttpCookie::HttpCookie | ( | const QByteArray | source | ) |
Create a cookie from a string.
source | String as received in a HTTP Cookie2 header. |
Definition at line 31 of file httpcookie.cpp.
References comment, domain, httpOnly, maxAge, name, path, secure, splitCSV(), value, and version.
QByteArray HttpCookie::getComment | ( | ) | const |
QByteArray HttpCookie::getDomain | ( | ) | const |
bool HttpCookie::getHttpOnly | ( | ) | const |
Get the HTTP-only flag of this cookie
Definition at line 209 of file httpcookie.cpp.
References httpOnly.
int HttpCookie::getMaxAge | ( | ) | const |
Get the maximum age of this cookie in seconds.
Definition at line 194 of file httpcookie.cpp.
References maxAge.
QByteArray HttpCookie::getName | ( | ) | const |
Get the name of this cookie
Definition at line 174 of file httpcookie.cpp.
References name.
Referenced by qtwebapp::HttpResponse::setCookie().
QByteArray HttpCookie::getPath | ( | ) | const |
bool HttpCookie::getSecure | ( | ) | const |
Get the secure flag of this cookie
Definition at line 204 of file httpcookie.cpp.
References secure.
QByteArray HttpCookie::getValue | ( | ) | const |
int HttpCookie::getVersion | ( | ) | const |
void HttpCookie::setComment | ( | const QByteArray | comment | ) |
void HttpCookie::setDomain | ( | const QByteArray | domain | ) |
void HttpCookie::setHttpOnly | ( | const bool | httpOnly | ) |
Set HTTP-only mode, so that he browser does not allow client-side scripts to access the cookie
Definition at line 169 of file httpcookie.cpp.
References httpOnly.
void HttpCookie::setMaxAge | ( | const int | maxAge | ) |
Set the maximum age of this cookie in seconds. 0=discard immediately
Definition at line 154 of file httpcookie.cpp.
References maxAge.
void HttpCookie::setName | ( | const QByteArray | name | ) |
void HttpCookie::setPath | ( | const QByteArray | path | ) |
Set the path for that the cookie will be sent, default="/" which means the whole domain
Definition at line 159 of file httpcookie.cpp.
References path.
void HttpCookie::setSecure | ( | const bool | secure | ) |
Set secure mode, so that the cookie will be sent by the browser to the server only on secure connections
Definition at line 164 of file httpcookie.cpp.
References secure.
void HttpCookie::setValue | ( | const QByteArray | value | ) |
|
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 219 of file httpcookie.cpp.
References i.
Referenced by qtwebapp::HttpRequest::extractCookies(), and HttpCookie().
QByteArray HttpCookie::toByteArray | ( | ) | const |
Convert this cookie to a string that may be used in a Set-Cookie header.
Definition at line 98 of file httpcookie.cpp.
References comment, domain, httpOnly, maxAge, name, path, secure, value, and version.
Referenced by qtwebapp::HttpResponse::writeHeaders().
|
private |
Definition at line 113 of file httpcookie.h.
Referenced by getComment(), HttpCookie(), setComment(), and toByteArray().
|
private |
Definition at line 114 of file httpcookie.h.
Referenced by getDomain(), HttpCookie(), setDomain(), and toByteArray().
|
private |
Definition at line 118 of file httpcookie.h.
Referenced by getHttpOnly(), HttpCookie(), setHttpOnly(), and toByteArray().
|
private |
Definition at line 115 of file httpcookie.h.
Referenced by getMaxAge(), HttpCookie(), setMaxAge(), and toByteArray().
|
private |
Definition at line 111 of file httpcookie.h.
Referenced by getName(), HttpCookie(), setName(), and toByteArray().
|
private |
Definition at line 116 of file httpcookie.h.
Referenced by getPath(), HttpCookie(), setPath(), and toByteArray().
|
private |
Definition at line 117 of file httpcookie.h.
Referenced by getSecure(), HttpCookie(), setSecure(), and toByteArray().
|
private |
Definition at line 112 of file httpcookie.h.
Referenced by getValue(), HttpCookie(), setValue(), and toByteArray().
|
private |
Definition at line 119 of file httpcookie.h.
Referenced by getVersion(), HttpCookie(), and toByteArray().