From 3e9014ed6179acd06a11dcd089490a6c16dc07e2 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?M=C3=A5rten=20Nordheim?= Date: Fri, 13 Mar 2020 17:48:16 +0100 Subject: QNetworkReply: stabilize sslSessionSharing test Sometimes this test would fail due to the session not actually being reused. The cause of this was that the requests were sometimes being completed 1-by-1, enabling the individual requests to re-use the already-connected socket completely because it stayed connected. Setting the Connection-header to close lets us be sure that the socket cannot be re-used when the request is finished. Fixes: QTBUG-82846 Change-Id: I5da8baa50a3a45fb60f1e1613e500e3e9c034fb0 Reviewed-by: Timur Pocheptsov --- tests/auto/network/access/qnetworkreply/tst_qnetworkreply.cpp | 3 +++ 1 file changed, 3 insertions(+) diff --git a/tests/auto/network/access/qnetworkreply/tst_qnetworkreply.cpp b/tests/auto/network/access/qnetworkreply/tst_qnetworkreply.cpp index 7d065f1248..6450d2a5d2 100644 --- a/tests/auto/network/access/qnetworkreply/tst_qnetworkreply.cpp +++ b/tests/auto/network/access/qnetworkreply/tst_qnetworkreply.cpp @@ -6490,6 +6490,9 @@ void tst_QNetworkReply::sslSessionSharing() QNetworkRequest warmupRequest(urlString); QFETCH(bool, sessionSharingEnabled); warmupRequest.setAttribute(QNetworkRequest::User, sessionSharingEnabled); // so we can read it from the slot + // Make sure the socket is closed when the request is finished to guarantee that + // the _socket_ is not reused, but rather the ssl session + warmupRequest.setRawHeader("Connection", "close"); if (! sessionSharingEnabled) { QSslConfiguration configuration(QSslConfiguration::defaultConfiguration()); configuration.setSslOption(QSsl::SslOptionDisableSessionSharing, true); -- cgit v1.2.3