diff options
author | Mikhail Svetkin <mikhail.svetkin@qt.io> | 2018-10-03 10:14:42 +0200 |
---|---|---|
committer | Mikhail Svetkin <mikhail.svetkin@qt.io> | 2018-10-04 08:12:29 +0000 |
commit | 2e7a82452673888d9beb3a8ef538acc2caf13a47 (patch) | |
tree | 6841d7742e9e7f7ec874db2e916dd507b038c071 /tests/auto/qhttpserverresponder/index.html | |
parent | f53818c8ef84999286da2fd83d32aeb2291668f5 (diff) |
Refactor QHttpServerResponder::write(QIODevice, ...)
The current implementation has several problems.
1. The function takes an ownership the QIODevice and puts it into a smartpointer.
Also we conntected socket's destroyed signal to lambda which has captured the
smartpointer.
So if responder does not find the file, the smartpointer will
call deleteLater which then will call socket::destroyed and then lambda
will be called and try to access the smartpointer which does not exist
anymore.
2. The function takes an ownership the file(QIODevice)
and puts it into a smartpointer.
Also we conntected the QTemporaryFile's aboutToClose signal to lambda which has captured the
smartpointer.
So when the QTemporaryFile calls destructor it will emit aboutToClose
signal which will call the lambda and this lambda will try to access the smartpointer
which does not exist anymore.
3. If we send a file smaller than chunksize,
IOChunkedTransfer we will never be deleted.
4. Does not check a socket connection type (keep-alive).
5. Does not send anything if file is not found or opened in wrong
mode.
Change-Id: I699e7d5a462c4b8d195908747bf0386132b19973
Reviewed-by: Jesus Fernandez <Jesus.Fernandez@qt.io>
Diffstat (limited to 'tests/auto/qhttpserverresponder/index.html')
-rw-r--r-- | tests/auto/qhttpserverresponder/index.html | 2 |
1 files changed, 2 insertions, 0 deletions
diff --git a/tests/auto/qhttpserverresponder/index.html b/tests/auto/qhttpserverresponder/index.html new file mode 100644 index 0000000..90531a4 --- /dev/null +++ b/tests/auto/qhttpserverresponder/index.html @@ -0,0 +1,2 @@ +<html> +</html> |