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

QNetworkAccessManager/QNetworkCookie/QNetworkCookieJar combo introduces backslash before quotation marks in JSON-formatted cookies

    XMLWordPrintable

Details

    • Bug
    • Resolution: Done
    • P2: Important
    • 5.0.0 Beta 1
    • 4.8.1
    • Network: Cookies
    • None
    • Gentoo Linux, x11-libs/qt-core-4.8.1-r3
    • 1120328357e63596ca7d81d5365c51bc1295c5d4

    Description

      Some pages such as IEEExplore (of IEEE) set cookies in JSON format. Such cookies contain quotation marks, which are not correctly handled by the combo of QNetworkAccessManager, QNetworkCookie, and QNetworkCookieJar.

      For example, an answer to a HTTP-GET request include the following header:
      Set-Cookie: xploreCookies=

      {"desktopReportingUrl":"null","userIds":"1938850","contactEmail":"NA","contactName":"NA","enterpriseLicenseId":"0","openUrlTxt":"NA","customerSurvey":"NA","standardsLicenseId":"0","openUrl":"NA","smallBusinessLicenseId":"0", "instImage":"1938850_univ skovde.gif","isMember":"false","products":"IEL|VDE|","openUrlImgLoc":"NA","isIp":"true","instName": "University of XXXXXX","oldSessionKey":"LmZ8hlXo5a9uZx2Fnyw1564T1ZOWMnf3Dk*oDx2FQHwbg6RYefyrhC8PL2wx3Dx3D-18x2d8723DyqXRnkILyGpmx2Fh9wgx3Dx3Dc2lAOhHqGSKT78xxGwXZxxCgx3Dx3D-XrL4FnIlW2OPkqtVJq0LkQx3Dx3D-tujOLwhFqtX7Pa7HGqmCXQx3Dx3D", "isChargebackUser":"false","isInst":"true"}

      ; domain=.ieee.org; path=/

      Cookie "xploreCookies" is essentially JSON-formatted data.
      When making subsequent requests to fetch more files from IEEE, this cookie has to be passed on. However, the "Cookie:" header in GET requests contain the JSON code in modified form, where all quotation marks are prepended by a backslash:

      Cookie: WLSESSION=908223116.20480.0000; ERIGHTS=LmZ8hlXo5a9uZx2Fnyw1564T1ZOWMnf3Dk*oDx2FQHwbg6RYefyrhC8PL2wx3Dx3D-18x2d8723DyqXRnkILyGpmx2Fh9wgx3Dx3Dc2lAOhHqGSKT78xxGwXZxxCgx3Dx3D-XrL4FnIlW2OPkqtVJq0LkQx3Dx3D-tujOLwhFqtX7Pa7HGqmCXQx3Dx3D; xploreCookies="

      {\"desktopReportingUrl\":\"null\",\"userIds\":\"1938850\",\"contactEmail\":\"NA\",\"contactName\":\"NA\",\"enterpriseLicenseId\":\"0\",\"openUrlTxt\":\"NA\",\"customerSurvey\":\"NA\",\"standardsLicenseId\":\"0\",\"openUrl\":\"NA\",\"smallBusinessLicenseId\":\"0\",\"instImage\":\"1938850_univ skovde.gif\",\"isMember\":\"false\",\"products\":\"IEL|VDE|\", \"openUrlImgLoc\":\"NA\",\"isIp\":\"true\",\"instName\":\"University of XXXXXX\",\"oldSessionKey\":\"LmZ8hlXo5a9uZx2Fnyw1564T1ZOWMnf3Dk* oDx2FQHwbg6RYefyrhC8PL2wx3Dx3D-18x2d8723DyqXRnkILyGpmx2Fh9wgx3Dx3Dc2lAOhHqGSKT78xxGwXZxxCgx3Dx3D-XrL4FnIlW2OPkqtVJq0LkQx3Dx3D-tujOLwhFqtX7Pa7HGqmCXQx3Dx3D\",\"isChargebackUser\":\"false\",\"isInst\":\"true\"}

      ";

      IEEE's web server does not accept such a modified cookie. Other browsers, such as Firefox, maintain the cookie's original format (i.e. without backslashes).

      Attachments

        Issue Links

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

          Activity

            People

              shkearns Shane Kearns
              thfischer T. Fischer
              Votes:
              0 Vote for this issue
              Watchers:
              5 Start watching this issue

              Dates

                Created:
                Updated:
                Resolved:

                Gerrit Reviews

                  There are no open Gerrit changes