本页内容

QHttp1Configuration Class

QHttp1Configuration 类用于控制 HTTP/1 的参数和设置。更多内容...

标题: #include <QHttp1Configuration>
CMake: find_package(Qt6 REQUIRED COMPONENTS Network)
target_link_libraries(mytarget PRIVATE Qt6::Network)
qmake: QT += network
自: Qt 6.5

注意:该类中的所有函数均为可重入函数。

公共函数

QHttp1Configuration()
QHttp1Configuration(const QHttp1Configuration &other)
QHttp1Configuration(QHttp1Configuration &&other)
~QHttp1Configuration()
qsizetype numberOfConnectionsPerHost() const
void setNumberOfConnectionsPerHost(qsizetype number)
void swap(QHttp1Configuration &other)
QHttp1Configuration &operator=(QHttp1Configuration &&other)
QHttp1Configuration &operator=(const QHttp1Configuration &other)
(since 6.5) size_t qHash(const QHttp1Configuration &key, size_t seed = 0)
(since 6.5) bool operator!=(const QHttp1Configuration &lhs, const QHttp1Configuration &rhs)
(since 6.5) bool operator==(const QHttp1Configuration &lhs, const QHttp1Configuration &rhs)

详细说明

QHttp1Configuration 控制 HTTP/1 参数和设置,QNetworkAccessManager 将使用这些参数和设置来发送请求和处理响应。

注意: 必须在向给定主机发送第一个请求(从而建立 HTTP/1 会话)之前设置该 配置。

另请参阅 QNetworkRequest::setHttp1Configuration()、QNetworkRequest::http1Configuration() 和QNetworkAccessManager 。

成员函数文档

QHttp1Configuration::QHttp1Configuration()

默认情况下会构建一个 QHttp1Configuration 对象。

QHttp1Configuration::QHttp1Configuration(const QHttp1Configuration &other)

复制并构建此 QHttp1Configuration。

[noexcept] QHttp1Configuration::QHttp1Configuration(QHttp1Configuration &&other)

通过“move-construct”操作将此 QHttp1Configuration 从other 创建。

注意: 被移动的源对象 other 处于部分初始化状态,在此状态下,唯一有效的操作是销毁和赋值。

[noexcept] QHttp1Configuration::~QHttp1Configuration()

析构函数。

qsizetype QHttp1Configuration::numberOfConnectionsPerHost() const

返回每个 http(s)host:port组合所使用的连接数。默认值为六 (6)。

另请参阅 setNumberOfConnectionsPerHost 。

void QHttp1Configuration::setNumberOfConnectionsPerHost(qsizetype number)

将每个 http(s)主机:端口组合使用的连接数(最小值:1;最大值:255)设置为number 。

如果 `number ` ≤ 0,则不执行任何操作。如果 `number ` > 255,则使用 255。

另请参阅 numberOfConnectionsPerHost 。

[noexcept] void QHttp1Configuration::swap(QHttp1Configuration &other)

将此 HTTP/1 配置替换为other 。此操作非常快速,且绝不会失败。

[noexcept] QHttp1Configuration &QHttp1Configuration::operator=(QHttp1Configuration &&other)

将other 移动并赋值给此QHttp1Configuration 。

注意: 被移动的对象 other 处于部分构筑状态,在此状态下,唯一有效的操作是销毁和赋值。

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

将other 复制并赋值给该QHttp1Configuration 。

相关非会员

[noexcept, since 6.5] size_t qHash(const QHttp1Configuration &key, size_t seed = 0)

返回key 的哈希值,并使用seed 作为计算的种子。

该函数于 Qt 6.5 中引入。

[noexcept, since 6.5] bool operator!=(const QHttp1Configuration &lhs, const QHttp1Configuration &rhs)

如果lhs 和rhs 表示的 HTTP/1 参数集不一致,则返回true 。

该函数自 Qt 6.5 起引入。

[noexcept, since 6.5] bool operator==(const QHttp1Configuration &lhs, const QHttp1Configuration &rhs)

如果lhs 和rhs 表示同一组 HTTP/1 参数,则返回true 。

该函数在 Qt 6.5 中引入。

© 2026 The Qt Company Ltd. Documentation contributions included herein are the copyrights of their respective owners. The documentation provided herein is licensed under the terms of the GNU Free Documentation License version 1.3 as published by the Free Software Foundation. Qt and respective logos are trademarks of The Qt Company Ltd. in Finland and/or other countries worldwide. All other trademarks are property of their respective owners.