summaryrefslogtreecommitdiffstats
path: root/src/network/access/qhttpthreaddelegate.cpp
diff options
context:
space:
mode:
authorMarkus Goetz <markus@woboq.com>2021-06-14 17:40:06 +0200
committerMarkus Goetz <markus@woboq.com>2021-07-27 17:16:58 +0200
commit85cfbae1d62617fdc452680813f993e812bb55dd (patch)
tree647525ccc36d6b3ff707f206869f882ff104a4c3 /src/network/access/qhttpthreaddelegate.cpp
parent5597e26256f37168b1da2bf8b6c1a9ab7ab2618c (diff)
QNAM: Allow to configure when connections to a host are torn down
This introduces a new attribute that allows behavior to keep the TCP connection(s) to a HTTP1/HTTP2 host longer or shorter than the default of 120 seconds. Note that the server might still close the connection earlier. Fixes: QTBUG-20726 Fixes: QTBUG-91440 Change-Id: I7da64230a78c642c12c0ddbe6b678cf17c3aafde Reviewed-by: MÃ¥rten Nordheim <marten.nordheim@qt.io>
Diffstat (limited to 'src/network/access/qhttpthreaddelegate.cpp')
-rw-r--r--src/network/access/qhttpthreaddelegate.cpp3
1 files changed, 2 insertions, 1 deletions
diff --git a/src/network/access/qhttpthreaddelegate.cpp b/src/network/access/qhttpthreaddelegate.cpp
index 8db56222d2..50a14b6258 100644
--- a/src/network/access/qhttpthreaddelegate.cpp
+++ b/src/network/access/qhttpthreaddelegate.cpp
@@ -226,6 +226,7 @@ QHttpThreadDelegate::QHttpThreadDelegate(QObject *parent) :
, pendingDownloadData()
, pendingDownloadProgress()
, synchronous(false)
+ , connectionCacheExpiryTimeoutSeconds(-1)
, incomingStatusCode(0)
, isPipeliningUsed(false)
, isHttp2Used(false)
@@ -344,7 +345,7 @@ void QHttpThreadDelegate::startRequest()
#endif
httpConnection->setPeerVerifyName(httpRequest.peerVerifyName());
// cache the QHttpNetworkConnection corresponding to this cache key
- connections.localData()->addEntry(cacheKey, httpConnection);
+ connections.localData()->addEntry(cacheKey, httpConnection, connectionCacheExpiryTimeoutSeconds);
} else {
if (httpRequest.withCredentials()) {
QNetworkAuthenticationCredential credential = authenticationManager->fetchCachedCredentials(httpRequest.url(), nullptr);