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 Class Reference

The QHttp2Configuration class controls HTTP/2 parameters and settings. More...

#include <qhttp2configuration.h>

+ Collaboration diagram for QHttp2Configuration:

Public Member Functions

 QHttp2Configuration ()
 Default constructs a QHttp2Configuration object.
 
 QHttp2Configuration (const QHttp2Configuration &other)
 Copy-constructs this QHttp2Configuration.
 
 QHttp2Configuration (QHttp2Configuration &&other) noexcept
 Move-constructs this QHttp2Configuration from other.
 
QHttp2Configurationoperator= (const QHttp2Configuration &other)
 Copy-assigns other to this QHttp2Configuration.
 
QHttp2Configurationoperator= (QHttp2Configuration &&other) noexcept
 Move-assigns other to this QHttp2Configuration.
 
 ~QHttp2Configuration ()
 Destructor.
 
void setServerPushEnabled (bool enable)
 If enable is true, a remote server can potentially use server push to send responses in advance.
 
bool serverPushEnabled () const
 Returns true if server push was enabled.
 
void setHuffmanCompressionEnabled (bool enable)
 If enable is true, HPACK compression will additionally compress string using the Huffman coding.
 
bool huffmanCompressionEnabled () const
 Returns true if the Huffman coding in HPACK is enabled.
 
bool setSessionReceiveWindowSize (unsigned size)
 Sets the window size for connection-level flow control.
 
unsigned sessionReceiveWindowSize () const
 Returns the window size for connection-level flow control.
 
bool setStreamReceiveWindowSize (unsigned size)
 Sets the window size for stream-level flow control.
 
unsigned streamReceiveWindowSize () const
 Returns the window size for stream-level flow control.
 
bool setMaxFrameSize (unsigned size)
 Sets the maximum frame size that QNetworkAccessManager will advertise to the server when sending its initial SETTINGS frame.
 
unsigned maxFrameSize () const
 Returns the maximum payload size that HTTP/2 frames can have.
 
void swap (QHttp2Configuration &other) noexcept
 Swaps this configuration with the other configuration.
 

Friends

bool operator== (const QHttp2Configuration &lhs, const QHttp2Configuration &rhs) noexcept
 Returns true if lhs and rhs have the same set of HTTP/2 parameters.
 
bool operator!= (const QHttp2Configuration &lhs, const QHttp2Configuration &rhs) noexcept
 Returns true if lhs and rhs do not have the same set of HTTP/2 parameters.
 

Detailed Description

The QHttp2Configuration class controls HTTP/2 parameters and settings.

Since
5.14

\reentrant \inmodule QtNetwork

QHttp2Configuration controls HTTP/2 parameters and settings that QNetworkAccessManager will use to send requests and process responses when the HTTP/2 protocol is enabled.

The HTTP/2 parameters that QHttp2Configuration currently supports include:

\list

  • The session window size for connection-level flow control. Will be sent to a remote peer when needed as 'WINDOW_UPDATE' frames on the stream with an identifier 0.
  • The stream receiving window size for stream-level flow control. Sent as 'SETTINGS_INITIAL_WINDOW_SIZE' parameter in the initial SETTINGS frame and, when needed, 'WINDOW_UPDATE' frames will be sent on streams that QNetworkAccessManager opens.
  • The maximum frame size. This parameter limits the maximum payload a frame coming from the remote peer can have. Sent by QNetworkAccessManager as 'SETTINGS_MAX_FRAME_SIZE' parameter in the initial 'SETTINGS' frame.
  • The server push. Allows to enable or disable server push. Sent as 'SETTINGS_ENABLE_PUSH' parameter in the initial 'SETTINGS' frame. \endlist

The QHttp2Configuration class also controls if the header compression algorithm (HPACK) is additionally using Huffman coding for string compression.

Note
The configuration must be set before the first request was sent to a given host (and thus an HTTP/2 session established).
Details about flow control, server push and 'SETTINGS' can be found in \l {https://httpwg.org/specs/rfc7540.html}{RFC 7540}. Different modes and parameters of the HPACK compression algorithm are described in \l {https://httpwg.org/specs/rfc7541.html}{RFC 7541}.
See also
QNetworkRequest::setHttp2Configuration(), QNetworkRequest::http2Configuration(), QNetworkAccessManager

Definition at line 16 of file qhttp2configuration.h.

Constructor & Destructor Documentation

◆ QHttp2Configuration() [1/3]

QHttp2Configuration::QHttp2Configuration ( )

Default constructs a QHttp2Configuration object.

Such a configuration has the following values: \list

  • Server push is disabled
  • Huffman string compression is enabled
  • Window size for connection-level flow control is 65535 octets
  • Window size for stream-level flow control is 65535 octets
  • Frame size is 16384 octets \endlist

Definition at line 86 of file qhttp2configuration.cpp.

◆ QHttp2Configuration() [2/3]

QHttp2Configuration::QHttp2Configuration ( const QHttp2Configuration & other)
default

Copy-constructs this QHttp2Configuration.

◆ QHttp2Configuration() [3/3]

QHttp2Configuration::QHttp2Configuration ( QHttp2Configuration && other)
noexcept

Move-constructs this QHttp2Configuration from other.

Definition at line 99 of file qhttp2configuration.cpp.

References other(), and swap().

+ Here is the call graph for this function:

◆ ~QHttp2Configuration()

QHttp2Configuration::~QHttp2Configuration ( )

Destructor.

Definition at line 117 of file qhttp2configuration.cpp.

Member Function Documentation

◆ huffmanCompressionEnabled()

bool QHttp2Configuration::huffmanCompressionEnabled ( ) const

Returns true if the Huffman coding in HPACK is enabled.

See also
setHuffmanCompressionEnabled

Definition at line 164 of file qhttp2configuration.cpp.

References QHttp2ConfigurationPrivate::huffmanCompressionEnabled.

◆ maxFrameSize()

unsigned QHttp2Configuration::maxFrameSize ( ) const

Returns the maximum payload size that HTTP/2 frames can have.

The default (initial) value is 16384 octets.

Definition at line 251 of file qhttp2configuration.cpp.

References QHttp2ConfigurationPrivate::maxFrameSize.

◆ operator=() [1/2]

QHttp2Configuration & QHttp2Configuration::operator= ( const QHttp2Configuration & other)
default

Copy-assigns other to this QHttp2Configuration.

◆ operator=() [2/2]

QHttp2Configuration & QHttp2Configuration::operator= ( QHttp2Configuration && other)
defaultnoexcept

Move-assigns other to this QHttp2Configuration.

◆ serverPushEnabled()

bool QHttp2Configuration::serverPushEnabled ( ) const

Returns true if server push was enabled.

Note
By default, QNetworkAccessManager disables server push via the 'SETTINGS' frame.
See also
setServerPushEnabled

Definition at line 140 of file qhttp2configuration.cpp.

References QHttp2ConfigurationPrivate::pushEnabled.

◆ sessionReceiveWindowSize()

unsigned QHttp2Configuration::sessionReceiveWindowSize ( ) const

Returns the window size for connection-level flow control.

The default value QNetworkAccessManager will be using is 2147483647 octets.

Definition at line 193 of file qhttp2configuration.cpp.

References QHttp2ConfigurationPrivate::sessionWindowSize.

◆ setHuffmanCompressionEnabled()

void QHttp2Configuration::setHuffmanCompressionEnabled ( bool enable)

If enable is true, HPACK compression will additionally compress string using the Huffman coding.

Enabled by default.

Note
This parameter only affects 'HEADERS' frames that QNetworkAccessManager is sending.
See also
huffmanCompressionEnabled

Definition at line 154 of file qhttp2configuration.cpp.

References QHttp2ConfigurationPrivate::huffmanCompressionEnabled.

◆ setMaxFrameSize()

bool QHttp2Configuration::setMaxFrameSize ( unsigned size)

Sets the maximum frame size that QNetworkAccessManager will advertise to the server when sending its initial SETTINGS frame.

Note
While this size is required to be within a range between 16384 and 16777215 inclusive, the actual payload size in frames that carry payload maybe be less than 16384.

Returns true on success, false otherwise.

Definition at line 236 of file qhttp2configuration.cpp.

References QHttp2ConfigurationPrivate::maxFrameSize, Http2::maxPayloadSize, and qCWarning.

◆ setServerPushEnabled()

void QHttp2Configuration::setServerPushEnabled ( bool enable)

If enable is true, a remote server can potentially use server push to send responses in advance.

See also
serverPushEnabled

Definition at line 127 of file qhttp2configuration.cpp.

References QHttp2ConfigurationPrivate::pushEnabled.

◆ setSessionReceiveWindowSize()

bool QHttp2Configuration::setSessionReceiveWindowSize ( unsigned size)

Sets the window size for connection-level flow control.

size cannot be 0 and must not exceed 2147483647 octets.

Returns true on success, false otherwise.

See also
sessionReceiveWindowSize

Definition at line 177 of file qhttp2configuration.cpp.

References Http2::maxSessionReceiveWindowSize(), qCWarning, and QHttp2ConfigurationPrivate::sessionWindowSize.

+ Here is the call graph for this function:

◆ setStreamReceiveWindowSize()

bool QHttp2Configuration::setStreamReceiveWindowSize ( unsigned size)

Sets the window size for stream-level flow control.

size cannot be 0 and must not exceed 2147483647 octets.

Returns true on success, false otherwise.

See also
streamReceiveWindowSize

Definition at line 206 of file qhttp2configuration.cpp.

References Http2::maxSessionReceiveWindowSize(), qCWarning, and QHttp2ConfigurationPrivate::streamWindowSize.

+ Here is the call graph for this function:

◆ streamReceiveWindowSize()

unsigned QHttp2Configuration::streamReceiveWindowSize ( ) const

Returns the window size for stream-level flow control.

The default value QNetworkAccessManager will be using is 214748364 octets (see \l {https://httpwg.org/specs/rfc7540.html#SettingValues}{RFC 7540}).

Definition at line 222 of file qhttp2configuration.cpp.

References QHttp2ConfigurationPrivate::streamWindowSize.

◆ swap()

void QHttp2Configuration::swap ( QHttp2Configuration & other)
noexcept

Swaps this configuration with the other configuration.

Definition at line 259 of file qhttp2configuration.cpp.

References d, and other().

+ Here is the call graph for this function:

Friends And Related Symbol Documentation

◆ operator!=

bool QHttp2Configuration::operator!= ( const QHttp2Configuration & lhs,
const QHttp2Configuration & rhs )
friend

Returns true if lhs and rhs do not have the same set of HTTP/2 parameters.

Definition at line 51 of file qhttp2configuration.h.

◆ operator==

bool QHttp2Configuration::operator== ( const QHttp2Configuration & lhs,
const QHttp2Configuration & rhs )
friend

Returns true if lhs and rhs have the same set of HTTP/2 parameters.

Definition at line 49 of file qhttp2configuration.h.


The documentation for this class was generated from the following files: