QHttp2Configuration Class

The QHttp2Configuration class controls HTTP/2 parameters and settings. 更多...

头: #include <QHttp2Configuration>
CMake: find_package(Qt6 COMPONENTS Network REQUIRED)
target_link_libraries(mytarget PRIVATE Qt6::Network)
qmake: QT += network
Since: Qt 5.14

注意: 此类的所有函数 可重入 .

公共函数

  QHttp2Configuration (QHttp2Configuration && other )
  QHttp2Configuration (const QHttp2Configuration & other )
  QHttp2Configuration ()
QHttp2Configuration & operator= (QHttp2Configuration && other )
QHttp2Configuration & operator= (const QHttp2Configuration & other )
  ~QHttp2Configuration ()
bool huffmanCompressionEnabled () const
无符号 int maxFrameSize () const
bool serverPushEnabled () const
无符号 int sessionReceiveWindowSize () const
void setHuffmanCompressionEnabled (bool enable )
bool setMaxFrameSize (unsigned int size )
void setServerPushEnabled (bool enable )
bool setSessionReceiveWindowSize (unsigned int size )
bool setStreamReceiveWindowSize (unsigned int size )
无符号 int streamReceiveWindowSize () const
void swap (QHttp2Configuration & other )
bool operator!= (const QHttp2Configuration & lhs , const QHttp2Configuration & rhs )
bool operator== (const QHttp2Configuration & lhs , const QHttp2Configuration & rhs )

详细描述

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:

  • 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.

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

注意: 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 RFC 7540 . Different modes and parameters of the HPACK compression algorithm are described in RFC 7541 .

另请参阅 QNetworkRequest::setHttp2Configuration (), QNetworkRequest::http2Configuration (),和 QNetworkAccessManager .

成员函数文档编制

QHttp2Configuration:: QHttp2Configuration ( QHttp2Configuration && other )

Move-constructs this QHttp2Configuration from other

QHttp2Configuration:: QHttp2Configuration (const QHttp2Configuration & other )

Copy-constructs this QHttp2Configuration.

QHttp2Configuration:: QHttp2Configuration ()

Default constructs a QHttp2Configuration object.

Such a configuration has the following values:

  • 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

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

移动赋值 other 到此 QHttp2Configuration .

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

Copy-assigns other 到此 QHttp2Configuration .

QHttp2Configuration:: ~QHttp2Configuration ()

析构函数。

bool QHttp2Configuration:: huffmanCompressionEnabled () const

返回 true if the Huffman coding in HPACK is enabled.

另请参阅 setHuffmanCompressionEnabled .

unsigned int QHttp2Configuration:: maxFrameSize () const

Returns the maximum payload size that HTTP/2 frames can have. The default (initial) value is 16384 octets.

另请参阅 setMaxFrameSize ().

bool QHttp2Configuration:: serverPushEnabled () const

Returns true if server push was enabled.

注意: 默认情况下, QNetworkAccessManager disables server push via the 'SETTINGS' frame.

另请参阅 setServerPushEnabled .

unsigned int QHttp2Configuration:: sessionReceiveWindowSize () const

Returns the window size for connection-level flow control. The default value QNetworkAccessManager will be using is 2147483647 octets.

另请参阅 setSessionReceiveWindowSize ().

void QHttp2Configuration:: setHuffmanCompressionEnabled ( bool enable )

enable is true , HPACK compression will additionally compress string using the Huffman coding. Enabled by default.

注意: This parameter only affects 'HEADERS' frames that QNetworkAccessManager is sending.

另请参阅 huffmanCompressionEnabled .

bool QHttp2Configuration:: setMaxFrameSize ( unsigned int size )

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

注意: 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.

返回 true 当成功时, false 否则。

另请参阅 maxFrameSize ().

void QHttp2Configuration:: setServerPushEnabled ( bool enable )

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

另请参阅 serverPushEnabled .

bool QHttp2Configuration:: setSessionReceiveWindowSize ( unsigned int size )

Sets the window size for connection-level flow control. size cannot be 0 and must not exceed 2147483647 octets.

返回 true 当成功时, false 否则。

另请参阅 sessionReceiveWindowSize .

bool QHttp2Configuration:: setStreamReceiveWindowSize ( unsigned int size )

Sets the window size for stream-level flow control. size cannot be 0 and must not exceed 2147483647 octets.

返回 true 当成功时, false 否则。

另请参阅 streamReceiveWindowSize .

unsigned int QHttp2Configuration:: streamReceiveWindowSize () const

Returns the window size for stream-level flow control. The default value QNetworkAccessManager will be using is 65535 octets (see RFC 7540 ).

另请参阅 setStreamReceiveWindowSize ().

void QHttp2Configuration:: swap ( QHttp2Configuration & other )

Swaps this configuration with the other 配置。

相关非成员

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

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

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

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