Details
-
Bug
-
Resolution: Unresolved
-
P2: Important
-
None
-
5.12.3
-
None
Description
If you have a QNetworkCookie with a domain set as "example.com" and you call cookiesForUrl() on the cookie jar with a subdomain URL such as "www.example.com", it will not return the cookie.
It seems Qt is using the older RFC behavior of only sending the cookie to subdomains if a leading "." is present. This requirement was removed in the RFC: https://tools.ietf.org/html/rfc6265#section-4.1.2.3
Seems most webservers still prepend the leading "." for cookies for the main domain for clients that might still implement only this old behavior. But I have ran into a few that do not, and Qt will not send the correct cookies to the subdomains, whereas modern browsers do.
Looking at qnetworkcookiejar.cpp, it seems the fix would be as simple as removing the first conditional inside the isParentDomain() function.