diff options
Diffstat (limited to 'tests/auto/network/access')
-rw-r--r-- | tests/auto/network/access/http2/tst_http2.cpp | 4 | ||||
-rw-r--r-- | tests/auto/network/access/qnetworkreply/tst_qnetworkreply.cpp | 28 |
2 files changed, 31 insertions, 1 deletions
diff --git a/tests/auto/network/access/http2/tst_http2.cpp b/tests/auto/network/access/http2/tst_http2.cpp index e433293a2c..9befb7276e 100644 --- a/tests/auto/network/access/http2/tst_http2.cpp +++ b/tests/auto/network/access/http2/tst_http2.cpp @@ -124,6 +124,7 @@ private: const Http2Settings tst_Http2::defaultServerSettings{{Http2::Settings::MAX_CONCURRENT_STREAMS_ID, 100}}; const Http2Settings tst_Http2::defaultClientSettings{{Http2::Settings::MAX_FRAME_SIZE_ID, quint32(Http2::maxFrameSize)}, + {Http2::Settings::INITIAL_WINDOW_SIZE_ID, quint32(Http2::initialStreamReceiveWindowSize)}, {Http2::Settings::ENABLE_PUSH_ID, quint32(0)}}; namespace { @@ -274,7 +275,7 @@ void tst_Http2::flowControlClientSide() ServerPtr srv(newServer(serverSettings)); - const QByteArray respond(int(Http2::defaultSessionWindowSize * 50), 'x'); + const QByteArray respond(int(Http2::initialStreamReceiveWindowSize * 5), 'x'); srv->setResponseBody(respond); QMetaObject::invokeMethod(srv.data(), "startServer", Qt::QueuedConnection); @@ -342,6 +343,7 @@ void tst_Http2::pushPromise() const EnvVarGuard env("QT_HTTP2_ENABLE_PUSH_PROMISE", "1"); const Http2Settings clientSettings{{Settings::MAX_FRAME_SIZE_ID, quint32(Http2::maxFrameSize)}, + {Http2::Settings::INITIAL_WINDOW_SIZE_ID, quint32(Http2::initialStreamReceiveWindowSize)}, {Settings::ENABLE_PUSH_ID, quint32(1)}}; ServerPtr srv(newServer(defaultServerSettings, clientSettings)); diff --git a/tests/auto/network/access/qnetworkreply/tst_qnetworkreply.cpp b/tests/auto/network/access/qnetworkreply/tst_qnetworkreply.cpp index 40e909113e..49abbede35 100644 --- a/tests/auto/network/access/qnetworkreply/tst_qnetworkreply.cpp +++ b/tests/auto/network/access/qnetworkreply/tst_qnetworkreply.cpp @@ -488,6 +488,7 @@ private Q_SLOTS: void ioHttpRedirectPolicyErrors(); void ioHttpUserVerifiedRedirect_data(); void ioHttpUserVerifiedRedirect(); + void ioHttpCookiesDuringRedirect(); #ifndef QT_NO_SSL void putWithServerClosingConnectionImmediately(); #endif @@ -8456,6 +8457,33 @@ void tst_QNetworkReply::ioHttpUserVerifiedRedirect() QCOMPARE(reply->attribute(QNetworkRequest::HttpStatusCodeAttribute).toInt(), statusCode); } +void tst_QNetworkReply::ioHttpCookiesDuringRedirect() +{ + MiniHttpServer target(httpEmpty200Response, false); + + const QString cookieHeader = QStringLiteral("Set-Cookie: hello=world; Path=/;\r\n"); + QString redirect = tempRedirectReplyStr(); + // Insert 'cookieHeader' before the final \r\n + redirect.insert(redirect.length() - 2, cookieHeader); + + QUrl url("http://localhost/"); + url.setPort(target.serverPort()); + redirect = redirect.arg(url.toString()); + MiniHttpServer redirectServer(redirect.toLatin1(), false); + + url = QUrl("http://localhost/"); + url.setPort(redirectServer.serverPort()); + QNetworkRequest request(url); + auto oldRedirectPolicy = manager.redirectPolicy(); + manager.setRedirectPolicy(QNetworkRequest::RedirectPolicy::NoLessSafeRedirectPolicy); + QNetworkReplyPtr reply(manager.get(request)); + // Set policy back to whatever it was + manager.setRedirectPolicy(oldRedirectPolicy); + + QVERIFY(waitForFinish(reply) == Success); + QVERIFY(target.receivedData.contains("\r\nCookie: hello=world\r\n")); +} + #ifndef QT_NO_SSL class PutWithServerClosingConnectionImmediatelyHandler: public QObject |