Qt
Internal/Contributor docs for the Qt SDK. <b>Note:</b> These are NOT official API docs; those are found <a href='https://doc.qt.io/'>here</a>.
Loading...
Searching...
No Matches
qhttp2configuration.cpp
Go to the documentation of this file.
1// Copyright (C) 2019 The Qt Company Ltd.
2// SPDX-License-Identifier: LicenseRef-Qt-Commercial OR LGPL-3.0-only OR GPL-2.0-only OR GPL-3.0-only
3
5
6#include "private/http2protocol_p.h"
7#include "private/hpack_p.h"
8
9#include "qdebug.h"
10
12
62{
63public:
66
67 unsigned maxFrameSize = Http2::minPayloadLimit; // Initial (default) value of 16Kb.
68
69 bool pushEnabled = false;
70 // TODO: for now those two below are noop.
72};
73
90
95
103
108
113
120
131
141{
142 return d->pushEnabled;
143}
144
158
168
178{
179 if (!size || size > Http2::maxSessionReceiveWindowSize) { // RFC-7540, 6.9
180 qCWarning(QT_HTTP2) << "Invalid session window size";
181 return false;
182 }
183
185 return true;
186}
187
194{
195 return d->sessionWindowSize;
196}
197
207{
208 if (!size || size > Http2::maxSessionReceiveWindowSize) { // RFC-7540, 6.9
209 qCWarning(QT_HTTP2) << "Invalid stream window size";
210 return false;
211 }
212
214 return true;
215}
216
223{
224 return d->streamWindowSize;
225}
226
237{
238 if (size < Http2::minPayloadLimit || size > Http2::maxPayloadSize) {
239 qCWarning(QT_HTTP2) << "Maximum frame size to advertise is invalid";
240 return false;
241 }
242
243 d->maxFrameSize = size;
244 return true;
245}
246
252{
253 return d->maxFrameSize;
254}
255
260{
261 d.swap(other.d);
262}
263
279bool QHttp2Configuration::isEqual(const QHttp2Configuration &other) const noexcept
280{
281 if (d == other.d)
282 return true;
283
284 return d->pushEnabled == other.d->pushEnabled
285 && d->huffmanCompressionEnabled == other.d->huffmanCompressionEnabled
286 && d->sessionWindowSize == other.d->sessionWindowSize
287 && d->streamWindowSize == other.d->streamWindowSize;
288}
289
The QHttp2Configuration class controls HTTP/2 parameters and settings.
QHttp2Configuration()
Default constructs a QHttp2Configuration object.
unsigned sessionReceiveWindowSize() const
Returns the window size for connection-level flow control.
unsigned streamReceiveWindowSize() const
Returns the window size for stream-level flow control.
bool setStreamReceiveWindowSize(unsigned size)
Sets the window size for stream-level flow control.
bool setSessionReceiveWindowSize(unsigned size)
Sets the window size for connection-level flow control.
void swap(QHttp2Configuration &other) noexcept
Swaps this configuration with the other configuration.
QHttp2Configuration & operator=(const QHttp2Configuration &other)
Copy-assigns other to this QHttp2Configuration.
bool serverPushEnabled() const
Returns true if server push was enabled.
unsigned maxFrameSize() const
Returns the maximum payload size that HTTP/2 frames can have.
bool huffmanCompressionEnabled() const
Returns true if the Huffman coding in HPACK is enabled.
bool setMaxFrameSize(unsigned size)
Sets the maximum frame size that QNetworkAccessManager will advertise to the server when sending its ...
void setServerPushEnabled(bool enable)
If enable is true, a remote server can potentially use server push to send responses in advance.
void setHuffmanCompressionEnabled(bool enable)
If enable is true, HPACK compression will additionally compress string using the Huffman coding.
\inmodule QtCore
Definition qshareddata.h:19
@ defaultSessionWindowSize
@ minPayloadLimit
const qint32 maxSessionReceiveWindowSize((quint32(1)<< 31) - 1)
Combined button and popup list for selecting options.
#define qCWarning(category,...)
GLenum GLuint GLintptr GLsizeiptr size
[1]
GLboolean enable
QSharedPointer< T > other(t)
[5]
this swap(other)