QHstsPolicy Class
The QHstsPolicy class specifies that a host supports HTTP Strict Transport Security policy (HSTS). 更多...
头文件: | #include <QHstsPolicy> |
qmake: | QT += network |
开始支持版本: | Qt 5.9 |
公有类型
enum | PolicyFlag { IncludeSubDomains } |
flags | PolicyFlags |
公有函数
QHstsPolicy() | |
QHstsPolicy(const QDateTime &expiry, PolicyFlags flags, const QString &host, QUrl::ParsingMode mode = QUrl::DecodedMode) | |
QHstsPolicy(const QHstsPolicy &other) | |
~QHstsPolicy() | |
QDateTime | expiry() const |
QString | host(QUrl::ComponentFormattingOptions options = QUrl::FullyDecoded) const |
bool | includesSubDomains() const |
bool | isExpired() const |
void | setExpiry(const QDateTime &expiry) |
void | setHost(const QString &host, QUrl::ParsingMode mode = QUrl::DecodedMode) |
void | setIncludesSubDomains(bool include) |
void | swap(QHstsPolicy &other) |
QHstsPolicy & | operator=(const QHstsPolicy &other) |
QHstsPolicy & | operator=(QHstsPolicy &&other) |
详细描述
The QHstsPolicy class specifies that a host supports HTTP Strict Transport Security policy (HSTS).
HSTS policy defines a period of time during which QNetworkAccessManager should only access a host in a secure fashion. HSTS policy is defined by RFC6797.
You can set expiry time and host name for this policy, and control whether it applies to subdomains, either in the constructor or by calling setExpiry(), setHost() and setIncludesSubdomains().
参见 QNetworkAccessManager::setStrictTransportSecurityEnabled().
成员类型
enum QHstsPolicy::PolicyFlag
flags QHstsPolicy::PolicyFlags
The PolicyFlags type is a typedef for QFlags<PolicyFlag>. It stores an OR combination of PolicyFlag values.
成员函数
QHstsPolicy::QHstsPolicy()
Constructs an invalid (expired) policy with empty host name and subdomains not included.
QHstsPolicy::QHstsPolicy(const QDateTime &expiry, PolicyFlags flags, const QString &host, QUrl::ParsingMode mode = QUrl::DecodedMode)
Constructs QHstsPolicy with expiry (in UTC): - host data is interpreted according to mode; - flags selects options to apply to this policy.
参见 QUrl::setHost(), QUrl::ParsingMode, and QHstsPolicy::PolicyFlag.
QHstsPolicy::QHstsPolicy(const QHstsPolicy &other)
Creates a copy of other object.
QHstsPolicy::~QHstsPolicy()
Destructor.
QDateTime QHstsPolicy::expiry() const
Returns the expiration date for the policy (in UTC).
参见 setExpiry().
QString QHstsPolicy::host(QUrl::ComponentFormattingOptions options = QUrl::FullyDecoded) const
Returns a host for a given policy, formatted according to options.
参见 setHost(), QUrl::host(), and QUrl::ComponentFormattingOptions.
bool QHstsPolicy::includesSubDomains() const
Returns true
if this policy also includes subdomains.
参见 setIncludesSubDomains().
bool QHstsPolicy::isExpired() const
Return true
if this policy has a valid expiration date and this date is greater than QDateTime::currentGetDateTimeUtc().
void QHstsPolicy::setExpiry(const QDateTime &expiry)
Sets the expiration date for the policy (in UTC) to expiry.
参见 expiry().
void QHstsPolicy::setHost(const QString &host, QUrl::ParsingMode mode = QUrl::DecodedMode)
Sets a host, host data is interpreted according to mode parameter.
参见 host(), QUrl::setHost(), and QUrl::ParsingMode.
void QHstsPolicy::setIncludesSubDomains(bool include)
Sets whether subdomains are included for this policy to include.
参见 includesSubDomains().
void QHstsPolicy::swap(QHstsPolicy &other)
QHstsPolicy &QHstsPolicy::operator=(const QHstsPolicy &other)
Copy-assignment operator, makes a copy of other.
QHstsPolicy &QHstsPolicy::operator=(QHstsPolicy &&other)
Move-assignment operator.