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

[REG 6.2.4->6.3.0] HTTP-Redirect is broken (ManualRedirectPolicy)

    XMLWordPrintable

Details

    • Bug
    • Resolution: Done
    • P1: Critical
    • 6.4.0 RC1, 6.5.0 Beta1
    • 6.3.0
    • Network: HTTP
    • None
    • Currently working with gcc (GCC) 12.1.0. We did not test other versions yet.
    • Android, Linux/X11
    • e3ea1d02e6 (qt/qtbase/dev) e3ea1d02e6 (qt/tqtc-qtbase/dev) 20b3d55090 (qt/qtbase/6.3) 20b3d55090 (qt/tqtc-qtbase/6.3) 9d70596799 (qt/qtbase/6.4) 9d70596799 (qt/tqtc-qtbase/6.4)

    Description

      With Qt 6.2.4 all is working fine but with Qt 6.3.0 we ran into a problem where a HTTP-Redirect (ManualRedirectPolicy) is no longer working. We are using exactly the same environment for both builds.

      The Problem seems to be in `QHttpNetworkReplyPrivate::expectContent()`. `Content-Length: 0` is contained in the redirect. But since Qt 6.3.0 the compiler decides to optimize the code and `expectedContentLength` is no longer available when the check is done. But after the check it becomes -1. But because bodyLength is -1 the next check also not succeeds and the function returns true at the end. Maybe the screenshots I appended make the situation more clear.

      We still try to solve the problem, but maybe anyone can help us. Sadly we are not able to provide a minimal example yet. With the attached test we can not reproduce the issue. Using the debugger in attached tests shows the same behavior. `QHttpNetworkReplyPrivate::expectContent()` returns true. But there seems to be an additional call of `QHttpProtocolHandler::_q_receiveReply()` where we ran into an early return that leads to the finished signal:

                      // finish this reply. this case happens when the server did not send a content length
                      m_reply->d_func()->state = QHttpNetworkReplyPrivate::AllDoneState;
                      m_channel->allDone();
                      return;
      

      But this is obviously wrong because there is a conent length.

      Attachments

        1. screen1.png
          screen1.png
          587 kB
        2. screen2.png
          screen2.png
          545 kB
        3. test_Redirect_RealData.cpp
          25 kB
        4. test_Redirect.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
            larss Lars Schmertmann
            Votes:
            1 Vote for this issue
            Watchers:
            4 Start watching this issue

            Dates

              Created:
              Updated:
              Resolved:

              Gerrit Reviews

                There are no open Gerrit changes