qnetworkcookiejar: optimize validateCookie
Use string view more to reduce allocations Change-Id: Ib73fb9607438c7da115406f61653641163370122 Reviewed-by: Mårten Nordheim <marten.nordheim@qt.io>
This commit is contained in:
parent
0774a9c556
commit
11a68f13e9
@ -305,13 +305,14 @@ bool QNetworkCookieJar::deleteCookie(const QNetworkCookie &cookie)
|
||||
*/
|
||||
bool QNetworkCookieJar::validateCookie(const QNetworkCookie &cookie, const QUrl &url) const
|
||||
{
|
||||
QString domain = cookie.domain();
|
||||
const QString cookieDomain = cookie.domain();
|
||||
QStringView domain = cookieDomain;
|
||||
const QString host = url.host();
|
||||
if (!isParentDomain(domain, host) && !isParentDomain(host, domain))
|
||||
return false; // not accepted
|
||||
|
||||
if (domain.startsWith(u'.'))
|
||||
domain = domain.mid(1);
|
||||
domain = domain.sliced(1);
|
||||
|
||||
// We shouldn't reject if:
|
||||
// "[...] the domain-attribute is identical to the canonicalized request-host"
|
||||
|
Loading…
Reference in New Issue
Block a user