Details
-
Bug
-
Resolution: Incomplete
-
Not Evaluated
-
None
-
6.4.1
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.