QHstsPolicy Class

Die Klasse QHstsPolicy gibt an, dass ein Host die HTTP Strict Transport Security Policy (HSTS) unterstützt. Mehr...

Kopfzeile: #include <QHstsPolicy>
CMake: find_package(Qt6 REQUIRED COMPONENTS Network)
target_link_libraries(mytarget PRIVATE Qt6::Network)
qmake: QT += network

Ö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)
bool operator!=(const QHstsPolicy &lhs, const QHstsPolicy &rhs)
bool operator==(const QHstsPolicy &lhs, const QHstsPolicy &rhs)

Detaillierte Beschreibung

Die HSTS-Richtlinie definiert einen Zeitraum, in dem QNetworkAccessManager nur auf sichere Weise auf einen Host zugreifen soll. Die HSTS-Richtlinie wird durch RFC6797 definiert.

Sie können die Ablaufzeit 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 der Mitgliedstypen

enum QHstsPolicy::PolicyFlag
flags QHstsPolicy::PolicyFlags

KonstanteWertBeschreibung
QHstsPolicy::IncludeSubDomains1Gibt 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()

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

Konstruiert QHstsPolicy mit expiry (in UTC); flags ist ein Wert, der angibt, ob diese Policy auch Subdomains enthalten muss, host Daten werden gemäß mode interpretiert.

Siehe auch QUrl::setHost(), QUrl::ParsingMode, und QHstsPolicy::PolicyFlag.

QHstsPolicy::QHstsPolicy(const QHstsPolicy &other)

Erzeugt eine Kopie des other Objekts.

[noexcept] QHstsPolicy::~QHstsPolicy()

Zerstörer.

QDateTime QHstsPolicy::expiry() const

Liefert das Ablaufdatum für die Police (in UTC).

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

Setzt das Ablaufdatum für die Richtlinie (in UTC) auf expiry.

Siehe auch expiry().

void QHstsPolicy::setHost(const QString &host, QUrl::ParsingMode mode = QUrl::DecodedMode)

Setzt einen Host, host Daten werden entsprechend dem mode Parameter interpretiert.

Siehe auch host(), QUrl::setHost(), und QUrl::ParsingMode.

void QHstsPolicy::setIncludesSubDomains(bool include)

Legt fest, ob Subdomänen für diese Richtlinie auf include einbezogen werden.

Siehe auch includesSubDomains().

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

Tauscht diese Richtlinie mit other aus. Dieser Vorgang ist sehr schnell und schlägt nie fehl.

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

Copy-Assignment-Operator, erstellt eine Kopie von other.

Verwandte Nicht-Mitglieder

bool operator!=(const QHstsPolicy &lhs, const QHstsPolicy &rhs)

Gibt true zurück, wenn die beiden Richtlinien lhs und rhs nicht denselben Host oder dasselbe Ablaufdatum haben oder nicht übereinstimmen, ob Subdomains eingeschlossen oder ausgeschlossen werden sollen.

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 darüber einig sind, ob sie Subdomains einschließen oder ausschließen sollen.

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