QHstsPolicy Class▲
-
Header: QHstsPolicy
-
Since: Qt 5.9
-
CMake:
find_package(Qt6 REQUIRED COMPONENTS Network)
target_link_libraries(mytarget PRIVATE Qt6::Network)
-
qmake: QT += network
-
Group: QHstsPolicy is part of Network Programming API
Detailed Description▲
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().
See Also▲
Member Type Documentation▲
enum QHstsPolicy::PolicyFlag▲
flags QHstsPolicy::PolicyFlags
Constant |
Value |
Description |
---|---|---|
QHstsPolicy::IncludeSubDomains |
1 |
Indicates whether a policy must include subdomains |
The PolicyFlags type is a typedef for QFlags<PolicyFlag>. It stores an OR combination of PolicyFlag values.
Member Function Documentation▲
QHstsPolicy::QHstsPolicy()▲
Constructs an invalid (expired) policy with empty host name and subdomains not included.
QHstsPolicy::QHstsPolicy(const QDateTime &expiry, QHstsPolicy::PolicyFlags flags, const QString &host, QUrl::ParsingMode mode = QUrl::DecodedMode)▲
Constructs QHstsPolicy with expiry (in UTC); flags is a value indicating whether this policy must also include subdomains, host data is interpreted according to mode.
See Also▲
See also QUrl::setHost(), QUrl::ParsingMode, QHstsPolicy::PolicyFlag
QHstsPolicy::QHstsPolicy(const QHstsPolicy &other)▲
Creates a copy of other object.
QHstsPolicy::~QHstsPolicy()▲
Destructor.
QDateTime QHstsPolicy::expiry() const▲
QString QHstsPolicy::host(QUrl::ComponentFormattingOptions options = QUrl::FullyDecoded) const▲
Returns a host for a given policy, formatted according to options.
See Also▲
See also setHost(), QUrl::host(), QUrl::ComponentFormattingOptions
bool QHstsPolicy::includesSubDomains() const▲
bool QHstsPolicy::isExpired() const▲
Return true if this policy has a valid expiration date and this date is greater than QDateTime::currentGetDateTimeUtc().
See Also▲
void QHstsPolicy::setExpiry(const QDateTime &expiry)▲
void QHstsPolicy::setHost(const QString &host, QUrl::ParsingMode mode = QUrl::DecodedMode)▲
Sets a host, host data is interpreted according to mode parameter.
See Also▲
See also host(), QUrl::setHost(), QUrl::ParsingMode
void QHstsPolicy::setIncludesSubDomains(bool include)▲
Sets whether subdomains are included for this policy to include.
See Also▲
See also includesSubDomains()
void QHstsPolicy::swap(QHstsPolicy &other)▲
Swaps this policy with the other policy.
QHstsPolicy &QHstsPolicy::operator=(const QHstsPolicy &other)▲
Copy-assignment operator, makes a copy of other.
Related Non-Members▲
bool operator!=(const QHstsPolicy &lhs, const QHstsPolicy &rhs)▲
Returns true if the two policies lhs and rhs do not have the same host or expiration date, or do not agree on whether to include or exclude subdomains.
bool operator==(const QHstsPolicy &lhs, const QHstsPolicy &rhs)▲
Returns true if the two policies lhs and rhs have the same host and expiration date while agreeing on whether to include or exclude subdomains.