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

HTTP 408 Request Time-out on Idle Sockets

    XMLWordPrintable

Details

    • Bug
    • Resolution: Unresolved
    • P2: Important
    • Some future release
    • 5.3.0
    • Network: HTTP
    • None
    • Ubuntu 12.04 LTS

    Description

      While using the QtTestBrowser, I've been receiving some console errors complaining about receiving 408 Request Time-out responses from the server. The problem is that the 408 Request Time-out message is received before the request is made, but this error considered to be the response to the request.

      This problem seems to be similar to what is being discussed here: http://lists.w3.org/Archives/Public/ietf-http-wg/2014AprJun/1132.html

      I see this happening in two situations in Qt:

      1) A TCP socket is opened and messages are sent with a HTTP "Connection: Keep-Alive" so that the socket can be used for multiple HTTP transactions. After a while, the server times out, sends a 408 message, and closes the socket. Qt receives this 408 message, but does not process it, because there is no request associated with the HTTP channel. Furthermore, Qt does not detect that the server closed the TCP socket, so Qt does not mark this HTTP channel as closed. The next time a request is made on this HTTP channel, the request message is sent (on the closed socket!) and when the response is read, it reads the old 408 message that was previously received, thinking that this is a response to the request just made.

      2) This is similar to (1), but socket starts off unused, and just receives a 408 from the server, which also closes the socket. Qt goes to send data on the socket, and the same as (1) happens. This can be seen in the attached screenshot from wireshark.

      It does not seem like correct behavior to associate the 408 message of a closed socket with a new request that is about to be made.

      A quick solution that I came up with is to close the connection if data is received on a channel that is not associated with a request:
      — qt/qtbase/src/network/access/qhttpnetworkconnectionchannel.cpp 2014-07-31 08:54:44.432328147 +0000
      +++ qt/qtbase/src/network/access/qhttpnetworkconnectionchannel_no408error.cpp 2014-07-31 08:56:04.363358214 +0000
      @@ -215,6 +215,8 @@
      void QHttpNetworkConnectionChannel::_q_readyRead()

      { Q_ASSERT(!protocolHandler.isNull()); + if (request.url().isEmpty()) + return close(); protocolHandler->_q_readyRead(); }

      The more correct solution would be to detect that the socket was closed (or that a 408 was received, without having made a request).

      Attachments

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

        Activity

          People

            peter-har Peter Hartmann
            tjebb Theo
            Votes:
            0 Vote for this issue
            Watchers:
            3 Start watching this issue

            Dates

              Created:
              Updated:

              Gerrit Reviews

                There are no open Gerrit changes