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

Crash when the QHttpServerResponder::write() function writes to an unconnected socket

    XMLWordPrintable

Details

    • Windows

    Description

      The function does not guard against that and instead it has a Q_ASSERT(socket->isOpen) which will hit in debug mode.

      Another thing observed when looking at the source code is that this behavior is not consistent.
      When calling QHttpServerResponder::write(IODevice...), it actually checks the socket state before starting a chunked transfer.
      But it can crash later if the socket is closed during the transfer as there are no guards against the write in the IOChunkedTransfer.

      The api documentation of the QHttpServerResponder does not provide any information about this.

      Other parts of the QHttpServer frameworks checks the socket state before write like QHttpServerResponse::write.

      About the sample function:
      The sample function creates a simple httpserver which delays a request (off loaded by a worker thread) and returns the response when its done.
      If a client disconnect before the response is written the application crash.

      Attachments

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

        Activity

          People

            manordheim MÃ¥rten Nordheim
            pijaouen Pierre Jaouen
            Votes:
            0 Vote for this issue
            Watchers:
            4 Start watching this issue

            Dates

              Created:
              Updated:
              Resolved:

              Gerrit Reviews

                There are no open Gerrit changes