H2: remove a rather useless limit on the number of streams
authorDebian Qt/KDE Maintainers <debian-qt-kde@lists.debian.org>
Sun, 7 Aug 2022 13:56:40 +0000 (14:56 +0100)
committerDmitry Shachnev <mitya57@debian.org>
Sun, 7 Aug 2022 13:56:40 +0000 (14:56 +0100)
Origin: upstream, https://code.qt.io/cgit/qt/qtbase.git/commit/?id=46940ca73791e87e
Last-Update: 2022-06-20

SETTINGS for max concurrect number of streams is 'one direction' - this
is how our peer conveys the possible number of streams _we_ can open,
not _them_. If they choose to have it unlimited - let it be so.

It's possible to send 0 as maximum number, also, it's possible to
reduce the maximum compared to initial at some point - then I have
to avoid integer overflows.

Gbp-Pq: Name remove_limit_on_number_of_streams.diff

src/network/access/http2/http2protocol_p.h
src/network/access/qhttp2protocolhandler.cpp

index b0af5aa91921bf5229e2d54284687bafb1969eb1..ed5f2bf561f2bd62c6ef7fd1fde29e867d374603 100644 (file)
@@ -133,9 +133,6 @@ enum Http2PredefinedParameters
     maxPayloadSize = (1 << 24) - 1, // HTTP/2 6.5.2
 
     defaultSessionWindowSize = 65535, // HTTP/2 6.5.2
-    // Using 1000 (rather arbitrarily), just to
-    // impose *some* upper limit:
-    maxPeerConcurrentStreams  = 1000,
     maxConcurrentStreams = 100 // HTTP/2, 6.5.2
 };
 
index 91c41d8240d6e1f8d9b8d4a99de2228f58e6055e..447e37640dd57df92686e0a181adb1c3d5702d2e 100644 (file)
@@ -393,7 +393,8 @@ bool QHttp2ProtocolHandler::sendRequest()
         initReplyFromPushPromise(message, key);
     }
 
-    const auto streamsToUse = std::min<quint32>(maxConcurrentStreams - activeStreams.size(),
+    const auto streamsToUse = std::min<quint32>(maxConcurrentStreams > activeStreams.size()
+                                                ? maxConcurrentStreams - activeStreams.size() : 0,
                                                 requests.size());
     auto it = requests.begin();
     for (quint32 i = 0; i < streamsToUse; ++i) {
@@ -1078,13 +1079,8 @@ bool QHttp2ProtocolHandler::acceptSetting(Http2::Settings identifier, quint32 ne
         QMetaObject::invokeMethod(this, "resumeSuspendedStreams", Qt::QueuedConnection);
     }
 
-    if (identifier == Settings::MAX_CONCURRENT_STREAMS_ID) {
-        if (newValue > maxPeerConcurrentStreams) {
-            connectionError(PROTOCOL_ERROR, "SETTINGS invalid number of concurrent streams");
-            return false;
-        }
+    if (identifier == Settings::MAX_CONCURRENT_STREAMS_ID)
         maxConcurrentStreams = newValue;
-    }
 
     if (identifier == Settings::MAX_FRAME_SIZE_ID) {
         if (newValue < Http2::minPayloadLimit || newValue > Http2::maxPayloadSize) {