diff options
-rw-r--r-- | src/network/access/qnetworkcookie.cpp | 9 | ||||
-rw-r--r-- | src/network/access/qnetworkcookie_p.h | 1 |
2 files changed, 9 insertions, 1 deletions
diff --git a/src/network/access/qnetworkcookie.cpp b/src/network/access/qnetworkcookie.cpp index 16c38d89ab..cf1232e37f 100644 --- a/src/network/access/qnetworkcookie.cpp +++ b/src/network/access/qnetworkcookie.cpp @@ -180,7 +180,8 @@ bool QNetworkCookie::operator==(const QNetworkCookie &other) const d->domain == other.d->domain && d->path == other.d->path && d->secure == other.d->secure && - d->comment == other.d->comment; + d->comment == other.d->comment && + d->sameSite == other.d->sameSite; } /*! @@ -459,6 +460,10 @@ QByteArray QNetworkCookie::toRawForm(RawForm form) const result += "; secure"; if (isHttpOnly()) result += "; HttpOnly"; + if (!d->sameSite.isEmpty()) { + result += "; SameSite="; + result += d->sameSite; + } if (!isSessionCookie()) { result += "; expires="; result += QLocale::c().toString(d->expirationDate.toUTC(), @@ -993,6 +998,8 @@ QList<QNetworkCookie> QNetworkCookiePrivate::parseSetCookieHeaderLine(const QByt cookie.setSecure(true); } else if (field.first == "httponly") { cookie.setHttpOnly(true); + } else if (field.first == "samesite") { + cookie.d->sameSite = field.second; } else { // ignore unknown fields in the cookie (RFC6265 section 5.2, rule 6) } diff --git a/src/network/access/qnetworkcookie_p.h b/src/network/access/qnetworkcookie_p.h index 13538ad243..e30e611cf5 100644 --- a/src/network/access/qnetworkcookie_p.h +++ b/src/network/access/qnetworkcookie_p.h @@ -66,6 +66,7 @@ public: QString domain; QString path; QString comment; + QByteArray sameSite; QByteArray name; QByteArray value; bool secure; |