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

QNetworkAccessManager sometimes fails to download content with content-encoding "gzip" and transfer-encoding "chunked"

    XMLWordPrintable

Details

    • macOS, Windows

    Description

      Hi all,

      we've just migrated our application from Qt 5.15.x to 6.2.x and encounter a blocker issue when fetching a specific http server response.

      Use Case:

      • our application sends HTTP 1.1 (also happens for 2.0) requests to an application server (also written with Qt) and processes the response
      • chunking is enabled (Transfer-Encoding: chunked)
      • gzip compression is enabled (Content-Encoding: gzip)
      • QNetworkAccessManager is used for communication
      • ssl is usually enabled (but is not related to this problem)
      • application runs on windows, macOS and iOS

      Problem:

      • network communication works as expected for all requests but one
      • this single request fails, the client stops with "Data Corrupted"
      • this issue only happens with Qt6 and a combination of chunking and gzip content encoding, there is no issue with Qt5
      • our server can only do HTTP 1.1, but when a reverse proxy translates to HTTP 2 it also happens when the client uses HTTP 2
      • the issue can reproduced with the small code snipped below on windows and macOS (windows Qt 6.3 vs2019, macOS Qt 6.2.2 xcode 13)

      As the problem only occurs for a special request only, i've included the whole server response that triggers the problem below "chunked-gzip-response.bin".

      To reproduce, build the small example and start it with a port number and the file as parameters:

      > <executable> 8081 chunked-gzip-response.bin

      This reproducible will start a Tcp server that listens on the given <port> and will just response with the file content for any request.
      Then it will use QNetworkAccessManager to download the file.

      With Qt5 everything runs through. With Qt6 the error slot is called with "Data Corrupt".

      Best regards,
      Maxim

      Attachments

        1. chunked-gzip-response.bin
          895 kB
        2. main.cpp
          3 kB
        No reviews matched the request. Check your Options in the drop-down menu of this sections header.

        Activity

          People

            manordheim MÃ¥rten Nordheim
            hrabowski Maximilian Hrabowski
            Votes:
            0 Vote for this issue
            Watchers:
            3 Start watching this issue

            Dates

              Created:
              Updated:
              Resolved:

              Gerrit Reviews

                There are no open Gerrit changes