Uploaded image for project: 'Qt'
  1. Qt
  2. QTBUG-76039

QNetworkCookieJar does not return cookies for subdomain

    XMLWordPrintable

Details

    • Bug
    • Resolution: Unresolved
    • P2: Important
    • None
    • 5.12.3
    • Network: Cookies
    • None
    • All

    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.

      Attachments

        No reviews matched the request. Check your Options in the drop-down menu of this sections header.

        Activity

          People

            manordheim Mårten Nordheim
            wallboy Adam W
            Votes:
            0 Vote for this issue
            Watchers:
            2 Start watching this issue

            Dates

              Created:
              Updated:

              Gerrit Reviews

                There are no open Gerrit changes