summaryrefslogtreecommitdiffstats
path: root/src/network/access
diff options
context:
space:
mode:
authorTimur Pocheptsov <timur.pocheptsov@qt.io>2021-10-11 14:30:29 +0200
committerTimur Pocheptsov <timur.pocheptsov@qt.io>2021-10-12 14:08:08 +0200
commit0e58b3db346c70babf10ffa8c813452cda65626c (patch)
tree8c43f19f72513e9acfb6de64f79de4fbe1db6e9b /src/network/access
parentb8360981791f876d835d3c3efcb1c6821e421b81 (diff)
Don't send the default SETTINGS_INITIAL_WINDOW_SIZE
And don't set non-default large value in QNetworkRequest's constructor. Some servers consider those values as 'flow control error'. Pick-to: 6.2 Fixes: QTBUG-97384 Change-Id: I801b7c83fe7e7392a02ba653c36dfa8a22c21d1e Reviewed-by: MÃ¥rten Nordheim <marten.nordheim@qt.io>
Diffstat (limited to 'src/network/access')
-rw-r--r--src/network/access/http2/http2protocol.cpp9
-rw-r--r--src/network/access/qhttp2configuration.cpp5
-rw-r--r--src/network/access/qnetworkrequest.cpp13
3 files changed, 14 insertions, 13 deletions
diff --git a/src/network/access/http2/http2protocol.cpp b/src/network/access/http2/http2protocol.cpp
index 31da6fd616..baae68bc30 100644
--- a/src/network/access/http2/http2protocol.cpp
+++ b/src/network/access/http2/http2protocol.cpp
@@ -71,9 +71,12 @@ Frame configurationToSettingsFrame(const QHttp2Configuration &config)
// Server push:
builder.append(Settings::ENABLE_PUSH_ID);
builder.append(int(config.serverPushEnabled()));
- // Stream receive window size:
- builder.append(Settings::INITIAL_WINDOW_SIZE_ID);
- builder.append(config.streamReceiveWindowSize());
+
+ // Stream receive window size (if it's a default value, don't include):
+ if (config.streamReceiveWindowSize() != defaultSessionWindowSize) {
+ builder.append(Settings::INITIAL_WINDOW_SIZE_ID);
+ builder.append(config.streamReceiveWindowSize());
+ }
if (config.maxFrameSize() != minPayloadLimit) {
builder.append(Settings::MAX_FRAME_SIZE_ID);
diff --git a/src/network/access/qhttp2configuration.cpp b/src/network/access/qhttp2configuration.cpp
index 4facfd7776..626a564fff 100644
--- a/src/network/access/qhttp2configuration.cpp
+++ b/src/network/access/qhttp2configuration.cpp
@@ -98,9 +98,6 @@ class QHttp2ConfigurationPrivate : public QSharedData
{
public:
unsigned sessionWindowSize = Http2::defaultSessionWindowSize;
- // The size below is quite a limiting default value, QNetworkRequest
- // by default sets a larger number, an application can change this using
- // QNetworkRequest::setHttp2Configuration.
unsigned streamWindowSize = Http2::defaultSessionWindowSize;
unsigned maxFrameSize = Http2::minPayloadLimit; // Initial (default) value of 16Kb.
@@ -256,7 +253,7 @@ bool QHttp2Configuration::setStreamReceiveWindowSize(unsigned size)
/*!
Returns the window size for stream-level flow control.
The default value QNetworkAccessManager will be using is
- 21474836 octets.
+ 65535 octets (see \l {https://httpwg.org/specs/rfc7540.html#SettingValues}{RFC 7540}).
*/
unsigned QHttp2Configuration::streamReceiveWindowSize() const
{
diff --git a/src/network/access/qnetworkrequest.cpp b/src/network/access/qnetworkrequest.cpp
index 688c29935c..3e9c12ae9e 100644
--- a/src/network/access/qnetworkrequest.cpp
+++ b/src/network/access/qnetworkrequest.cpp
@@ -492,13 +492,14 @@ public:
QNetworkRequest::QNetworkRequest()
: d(new QNetworkRequestPrivate)
{
-
#if QT_CONFIG(http)
- // Initial values proposed by RFC 7540 are quite draconian,
- // so unless an application will set its own parameters, we
- // make stream window size larger and increase (via WINDOW_UPDATE)
- // the session window size. These are our 'defaults':
- d->h2Configuration.setStreamReceiveWindowSize(Http2::qtDefaultStreamReceiveWindowSize);
+ // Initial values proposed by RFC 7540 are quite draconian, but we
+ // know about servers configured with this value as maximum possible,
+ // rejecting our SETTINGS frame and sending us a GOAWAY frame with the
+ // flow control error set. Unless an application sets its own parameters,
+ // we don't send SETTINGS_INITIAL_WINDOW_SIZE, but increase
+ // (via WINDOW_UPDATE) the session window size. These are our 'defaults':
+ d->h2Configuration.setStreamReceiveWindowSize(Http2::defaultSessionWindowSize);
d->h2Configuration.setSessionReceiveWindowSize(Http2::maxSessionReceiveWindowSize);
d->h2Configuration.setServerPushEnabled(false);
#endif // QT_CONFIG(http)