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 this QHttp1Configuration fromother

注: moved-from 对象other 处于部分形成状态,其中唯一有效的操作是销毁和分配新值。

[noexcept] QHttp1Configuration::~QHttp1Configuration()

毁灭者

qsizetype QHttp1Configuration::numberOfConnectionsPerHost() const

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

另请参阅 setNumberOfConnectionsPerHost

void QHttp1Configuration::setNumberOfConnectionsPerHost(qsizetype number)

将每个 http(s)host:port组合使用的连接数(最小: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)

复制分配otherQHttp1Configuration

相关非会员

[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)

如果lhsrhs 不代表同一组 HTTP/1 参数,则返回true

此函数在 Qt 6.5 中引入。

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

如果lhsrhs 表示同一组 HTTP/1 参数,则返回true

此函数在 Qt 6.5 中引入。

© 2025 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.