QHstsPolicy Class
Die Klasse „QHstsPolicy“ gibt an, dass ein Host die HSTS-Richtlinie (HTTP Strict Transport Security) unterstützt. Mehr dazu...
| Header: | #include <QHstsPolicy> |
| CMake: | find_package(Qt6 REQUIRED COMPONENTS Network) target_link_libraries(mytarget PRIVATE Qt6::Network) |
| qmake: | QT += network |
- Liste aller Mitglieder, einschließlich geerbter Mitglieder
- QHstsPolicy ist Teil der Netzwerkprogrammierungs-API.
Öffentliche Typen
| enum | PolicyFlag { IncludeSubDomains } |
| flags | PolicyFlags |
Öffentliche Funktionen
| QHstsPolicy() | |
| QHstsPolicy(const QDateTime &expiry, QHstsPolicy::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) |
Verwandte Nicht-Mitglieder
| bool | operator!=(const QHstsPolicy &lhs, const QHstsPolicy &rhs) |
| bool | operator==(const QHstsPolicy &lhs, const QHstsPolicy &rhs) |
Ausführliche Beschreibung
Die HSTS-Richtlinie legt einen Zeitraum fest, in dem QNetworkAccessManager nur auf sichere Weise auf einen Host zugreifen darf. Die HSTS-Richtlinie ist in RFC 6797 definiert.
Sie können die Gültigkeitsdauer und den Hostnamen für diese Richtlinie festlegen und steuern, ob sie für Subdomains gilt – entweder im Konstruktor oder durch Aufruf von ` setExpiry()`, ` setHost()` und ` setIncludesSubDomains()`.
Siehe auch QNetworkAccessManager::setStrictTransportSecurityEnabled().
Dokumentation zu den Mitgliedstypen
enum QHstsPolicy::PolicyFlag
flags QHstsPolicy::PolicyFlags
| Konstante | Wert | Beschreibung |
|---|---|---|
QHstsPolicy::IncludeSubDomains | 1 | Gibt an, ob eine Richtlinie Subdomänen enthalten muss |
Der Typ „PolicyFlags“ ist ein typedef für „QFlags<PolicyFlag>“. Er speichert eine ODER-Kombination von „PolicyFlag“-Werten.
Dokumentation der Mitgliedsfunktionen
QHstsPolicy::QHstsPolicy()
Erstellt eine ungültige (abgelaufene) Richtlinie mit leerem Hostnamen und ohne Subdomänen.
QHstsPolicy::QHstsPolicy(const QDateTime &expiry, QHstsPolicy::PolicyFlags flags, const QString &host, QUrl::ParsingMode mode = QUrl::DecodedMode)
Erstellt eine QHstsPolicy mit expiry (in UTC); flags ist ein Wert, der angibt, ob diese Richtlinie auch Subdomänen umfassen muss; host -Daten werden gemäß mode interpretiert.
Siehe auch QUrl::setHost(), QUrl::ParsingMode und QHstsPolicy::PolicyFlag.
QHstsPolicy::QHstsPolicy(const QHstsPolicy &other)
Erstellt eine Kopie des Objekts „ other “.
[noexcept] QHstsPolicy::~QHstsPolicy()
Destruktor.
QDateTime QHstsPolicy::expiry() const
Gibt das Ablaufdatum der Police (in UTC) zurück.
Siehe auch ` setExpiry()`.
QString QHstsPolicy::host(QUrl::ComponentFormattingOptions options = QUrl::FullyDecoded) const
Gibt einen Host für eine bestimmte Richtlinie zurück, formatiert gemäß options.
Siehe auch setHost(), QUrl::host() und QUrl::ComponentFormattingOptions.
bool QHstsPolicy::includesSubDomains() const
Gibt „ true “ zurück, wenn diese Richtlinie auch Subdomains umfasst.
Siehe auch setIncludesSubDomains().
bool QHstsPolicy::isExpired() const
Gibt „ true “ zurück, wenn diese Richtlinie ein gültiges Ablaufdatum hat und dieses Datum größer ist als „QDateTime::currentGetDateTimeUtc()“.
Siehe auch ` setExpiry()` und ` expiry()`.
void QHstsPolicy::setExpiry(const QDateTime &expiry)
Legt das Ablaufdatum der Richtlinie (in UTC) auf „ expiry “ fest.
Siehe auch expiry().
void QHstsPolicy::setHost(const QString &host, QUrl::ParsingMode mode = QUrl::DecodedMode)
Legt einen Host fest; die Daten unter host werden gemäß dem Parameter mode interpretiert.
Siehe auch host(), QUrl::setHost() und QUrl::ParsingMode.
void QHstsPolicy::setIncludesSubDomains(bool include)
Legt fest, ob Subdomains für diese Richtlinie unter include berücksichtigt werden.
Siehe auch includesSubDomains().
[noexcept] void QHstsPolicy::swap(QHstsPolicy &other)
Ersetzt diese Richtlinie durch „ other “. Dieser Vorgang ist sehr schnell und schlägt niemals fehl.
QHstsPolicy &QHstsPolicy::operator=(const QHstsPolicy &other)
Kopier-Zuweisungsoperator, erstellt eine Kopie von other.
Verwandte Nicht-Mitglieder
bool operator!=(const QHstsPolicy &lhs, const QHstsPolicy &rhs)
Gibt „ true “ zurück, wenn die beiden Zertifikate lhs und rhs nicht denselben Host oder dasselbe Ablaufdatum haben oder sich hinsichtlich der Einbeziehung bzw. des Ausschlusses von Subdomains nicht decken.
bool operator==(const QHstsPolicy &lhs, const QHstsPolicy &rhs)
Gibt „ true “ zurück, wenn die beiden Richtlinien „ lhs “ und „ rhs “ denselben Host und dasselbe Ablaufdatum haben und sich hinsichtlich der Einbeziehung bzw. des Ausschlusses von Subdomains decken.
© 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.