diff options
author | Allan Sandfeld Jensen <allan.jensen@qt.io> | 2020-10-14 10:12:38 +0200 |
---|---|---|
committer | Qt Cherry-pick Bot <cherrypick_bot@qt-project.org> | 2020-10-28 18:21:50 +0000 |
commit | 7927794a8183a4ad3cad01ced49998f069a4f79a (patch) | |
tree | 964ad3c1c134d9fc881a214fa9013c25641521b4 /src/network/access/qnetworkcookie.cpp | |
parent | 76947bf93ccd9b4c79e6b2f9a28b9f10be8315bb (diff) |
Pass SameSite through QNetworkCookie
It is an important new details in cookies, as a minimum pass it through,
before we add API for it.
Change-Id: I5222a24e0f50f3822a94cce126b5055fed1a8008
Reviewed-by: MÃ¥rten Nordheim <marten.nordheim@qt.io>
(cherry picked from commit 5dc1780369927b41b424277330d0e2ec7431252b)
Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
Diffstat (limited to 'src/network/access/qnetworkcookie.cpp')
-rw-r--r-- | src/network/access/qnetworkcookie.cpp | 9 |
1 files changed, 8 insertions, 1 deletions
diff --git a/src/network/access/qnetworkcookie.cpp b/src/network/access/qnetworkcookie.cpp index 47f6112b22..21950b18a5 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(), @@ -991,6 +996,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) } |