summaryrefslogtreecommitdiffstats
path: root/tests/auto
diff options
context:
space:
mode:
Diffstat (limited to 'tests/auto')
-rw-r--r--tests/auto/network/access/http2/http2srv.cpp14
-rw-r--r--tests/auto/network/access/http2/http2srv.h1
-rw-r--r--tests/auto/network/access/http2/tst_http2.cpp2
3 files changed, 16 insertions, 1 deletions
diff --git a/tests/auto/network/access/http2/http2srv.cpp b/tests/auto/network/access/http2/http2srv.cpp
index 1f9ffb8985..6e2220fa67 100644
--- a/tests/auto/network/access/http2/http2srv.cpp
+++ b/tests/auto/network/access/http2/http2srv.cpp
@@ -431,6 +431,13 @@ void Http2Server::readReady()
if (connectionError)
return;
+ if (redirectSent) {
+ // We are a "single shot" server, working in 'h2' mode,
+ // responding with a redirect code. Don't bother to handle
+ // anything else now.
+ return;
+ }
+
if (upgradeProtocol) {
handleProtocolUpgrade();
} else if (waitingClientPreface) {
@@ -800,6 +807,13 @@ void Http2Server::sendResponse(quint32 streamID, bool emptyBody)
HttpHeader header;
if (redirectWhileReading) {
+ if (redirectSent) {
+ // This is a "single-shot" server responding with a redirect code.
+ return;
+ }
+
+ redirectSent = true;
+
qDebug("server received HEADERS frame (followed by DATA frames), redirecting ...");
Q_ASSERT(targetPort);
header.push_back({":status", "308"});
diff --git a/tests/auto/network/access/http2/http2srv.h b/tests/auto/network/access/http2/http2srv.h
index 87a17ced8b..ae3f084fdc 100644
--- a/tests/auto/network/access/http2/http2srv.h
+++ b/tests/auto/network/access/http2/http2srv.h
@@ -193,6 +193,7 @@ private:
// Redirect, with status code 308, as soon as we've seen headers, while client
// may still be sending DATA frames. See tst_Http2::earlyResponse().
bool redirectWhileReading = false;
+ bool redirectSent = false;
quint16 targetPort = 0;
QAtomicInt interrupted;
protected slots:
diff --git a/tests/auto/network/access/http2/tst_http2.cpp b/tests/auto/network/access/http2/tst_http2.cpp
index 235b78c34a..52e98c1fc1 100644
--- a/tests/auto/network/access/http2/tst_http2.cpp
+++ b/tests/auto/network/access/http2/tst_http2.cpp
@@ -473,7 +473,7 @@ void tst_Http2::earlyResponse()
runEventLoop();
QVERIFY(serverPort);
- sendRequest(1, QNetworkRequest::NormalPriority, {10000000, Qt::Uninitialized});
+ sendRequest(1, QNetworkRequest::NormalPriority, {1000000, Qt::Uninitialized});
runEventLoop();