16 : QNetworkCookie(name, value)
17 , d(new CookiePrivate)
19 qRegisterMetaType<Cookie>();
20 qRegisterMetaType<QList<Cookie>>();
24 : QNetworkCookie(other)
33 QNetworkCookie::operator=(other);
40 if (QNetworkCookie::operator==(other) && d == other.d) {
44 return QNetworkCookie::operator==(other) && d->sameSite == other.d->sameSite;
54 d->sameSite = sameSite;
62 return QByteArrayLiteral(
"None");
64 return QByteArrayLiteral(
"Lax");
66 return QByteArrayLiteral(
"Strict");
89 result +=
"; HttpOnly";
91 result +=
"; SameSite=";
92 result += sameSiteToRawString(d->sameSite);
94 if (!isSessionCookie()) {
95 result +=
"; expires=";
96 result += QLocale::c()
97 .toString(expirationDate().toUTC(),
98 QStringLiteral(
"ddd, dd-MMM-yyyy hh:mm:ss 'GMT"))
101 if (!domain().isEmpty()) {
102 result +=
"; domain=";
103 if (domain().startsWith(u
'.')) {
105 result += QUrl::toAce(domain().mid(1));
107 QHostAddress hostAddr(domain());
108 if (hostAddr.protocol() == QAbstractSocket::IPv6Protocol) {
110 result += domain().toUtf8();
113 result += QUrl::toAce(domain());
117 if (!path().isEmpty()) {
119 result += path().toUtf8();
125#ifndef QT_NO_DEBUG_STREAM
128 QDebugStateSaver saver(s);
130 s.resetFormat().nospace();
131 s <<
"Cutelyst::Cookie(" << cookie.
toRawForm(Cookie::Full) <<
')';
136#include "moc_cookie.cpp"
SameSite sameSitePolicy() const
Returns the "SameSite" option if specified in the cookie string, SameSite::Default if not present.
Cookie(const QByteArray &name=QByteArray(), const QByteArray &value=QByteArray())
Create a new Cookie object, initializing the cookie name to name and its value to value.
void setSameSitePolicy(SameSite sameSite)
Sets the "SameSite" option of this cookie to sameSite.
bool operator==(const Cookie &other) const
Returns true if this cookie is equal to other.
~Cookie()
Destroys this Cookie object.
Cookie & operator=(Cookie &&other) noexcept
Move assigns the contents of the Cookie object other to this object.
QByteArray toRawForm(RawForm form=Full) const
Returns the raw form of this Cookie.
The Cutelyst namespace holds all public Cutelyst API.