QHttpServerConfiguration Class
Die Klasse QHttpServerConfiguration steuert Serverparameter. Mehr...
Kopfzeile: | #include <QHttpServerConfiguration> |
CMake: | find_package(Qt6 REQUIRED COMPONENTS HttpServer) target_link_libraries(mytarget PRIVATE Qt6::HttpServer) |
qmake: | QT += httpserver |
Seit: | Qt 6.9 |
Öffentliche Funktionen
QHttpServerConfiguration() | |
QHttpServerConfiguration(const QHttpServerConfiguration &other) | |
QHttpServerConfiguration(QHttpServerConfiguration &&other) | |
~QHttpServerConfiguration() | |
(since 6.10) QSpan<const std::pair<QHostAddress, int>> | blacklist() const |
(since 6.10) std::chrono::seconds | keepAliveTimeout() const |
quint32 | rateLimitPerSecond() const |
(since 6.10) void | setBlacklist(QSpan<const std::pair<QHostAddress, int>> subnetList) |
(since 6.10) void | setKeepAliveTimeout(std::chrono::seconds timeout) |
void | setRateLimitPerSecond(quint32 maxRequests) |
(since 6.10) void | setWhitelist(QSpan<const std::pair<QHostAddress, int>> subnetList) |
void | swap(QHttpServerConfiguration &other) |
(since 6.10) QSpan<const std::pair<QHostAddress, int>> | whitelist() const |
QHttpServerConfiguration & | operator=(QHttpServerConfiguration &&other) |
QHttpServerConfiguration & | operator=(const QHttpServerConfiguration &other) |
Verwandte Nicht-Mitglieder
bool | operator!=(const QHttpServerConfiguration &lhs, const QHttpServerConfiguration &rhs) |
bool | operator==(const QHttpServerConfiguration &lhs, const QHttpServerConfiguration &rhs) |
Dokumentation der Memberfunktionen
QHttpServerConfiguration::QHttpServerConfiguration()
Default konstruiert ein QHttpServerConfiguration-Objekt.
Eine solche Konfiguration hat die folgenden Werte:
- Ratenbegrenzung ist deaktiviert
QHttpServerConfiguration::QHttpServerConfiguration(const QHttpServerConfiguration &other)
Kopiert diese QHttpServerConfiguration.
[noexcept]
QHttpServerConfiguration::QHttpServerConfiguration(QHttpServerConfiguration &&other)
Verschieben-konstruiert diese QHttpServerConfiguration aus other
[noexcept]
QHttpServerConfiguration::~QHttpServerConfiguration()
Zerstörer.
[since 6.10]
QSpan<const std::pair<QHostAddress, int>> QHttpServerConfiguration::blacklist() const
Gibt die schwarze Liste der Subnetze zurück, denen der Zugriff durch QHttpServer verweigert wird.
Diese Funktion wurde in Qt 6.10 eingeführt.
Siehe auch setBlacklist().
[since 6.10]
std::chrono::seconds QHttpServerConfiguration::keepAliveTimeout() const
Gibt den von QHttpServer verwendeten Keep-Alive-Timeout zurück.
Diese Funktion wurde in Qt 6.10 eingeführt.
Siehe auch setKeepAliveTimeout().
quint32 QHttpServerConfiguration::rateLimitPerSecond() const
Gibt die maximale Anzahl der eingehenden Anfragen pro Sekunde pro IP zurück, die vom Server akzeptiert werden.
Siehe auch setRateLimitPerSecond().
[since 6.10]
void QHttpServerConfiguration::setBlacklist(QSpan<const std::pair<QHostAddress, int>> subnetList)
Legt subnetList als schwarze Liste für Subnetze fest.
IP-Adressen in dieser Liste wird der Zugriff durch QHttpServer verweigert. Die Blacklist ist nur aktiv, wenn die Whitelist leer ist.
Diese Funktion wurde in Qt 6.10 eingeführt.
Siehe auch blacklist(), setWhitelist(), und QHostAddress::parseSubnet().
[since 6.10]
void QHttpServerConfiguration::setKeepAliveTimeout(std::chrono::seconds timeout)
Legt timeout als Keep-Alive-Timeout für QHttpServer fest.
Das Keep-alive-Timeout bestimmt, wie lange eine inaktive Verbindung offen gehalten wird, bevor sie geschlossen wird. Standardmäßig ist die Zeitüberschreitung auf 15 Sekunden eingestellt.
Diese Funktion wurde in Qt 6.10 eingeführt.
Siehe auch keepAliveTimeout().
void QHttpServerConfiguration::setRateLimitPerSecond(quint32 maxRequests)
Legt maxRequests als maximale Anzahl von eingehenden Anfragen pro Sekunde und IP fest, die von QHttpServer akzeptiert werden. Wenn das Limit überschritten wird, antwortet QHttpServer mit QHttpServerResponder::StatusCode::TooManyRequests.
Siehe auch rateLimitPerSecond() und QHttpServerResponder::StatusCode.
[since 6.10]
void QHttpServerConfiguration::setWhitelist(QSpan<const std::pair<QHostAddress, int>> subnetList)
Legt subnetList als Whitelist der erlaubten Subnetze fest.
Wenn die Liste nicht leer ist, werden nur IP-Adressen in dieser Liste von QHttpServer zugelassen. Die Whitelist hat Vorrang vor der Blacklist.
Jedes Subnetz wird als Paar dargestellt, bestehend aus:
- Einer Basis-IP-Adresse vom Typ QHostAddress.
- Eine CIDR-Präfixlänge vom Typ int, die die Subnetzmaske definiert.
Um nur eine bestimmte IP-Adresse zuzulassen, verwenden Sie eine Präfixlänge von 32 für IPv4 (z.B. "192.168.1.100/32"
) oder 128 für IPv6 (z.B. "2001:db8::1/128"
).
Diese Funktion wurde in Qt 6.10 eingeführt.
Siehe auch whitelist(), setBlacklist(), und QHostAddress::parseSubnet().
[noexcept]
void QHttpServerConfiguration::swap(QHttpServerConfiguration &other)
Tauscht diese Konfiguration mit other aus. Dieser Vorgang ist sehr schnell und schlägt nie fehl.
[since 6.10]
QSpan<const std::pair<QHostAddress, int>> QHttpServerConfiguration::whitelist() const
Gibt die Whitelist der von QHttpServer erlaubten Subnetze zurück.
Diese Funktion wurde in Qt 6.10 eingeführt.
Siehe auch setWhitelist().
[noexcept]
QHttpServerConfiguration &QHttpServerConfiguration::operator=(QHttpServerConfiguration &&other)
Verschieben - ordnet other dieser QHttpServerConfiguration zu.
QHttpServerConfiguration &QHttpServerConfiguration::operator=(const QHttpServerConfiguration &other)
Kopiert other auf diese QHttpServerConfiguration.
Verwandte Nicht-Mitglieder
[noexcept]
bool operator!=(const QHttpServerConfiguration &lhs, const QHttpServerConfiguration &rhs)
Gibt true
zurück, wenn lhs und rhs nicht den gleichen Satz an Konfigurationsparametern haben.
[noexcept]
bool operator==(const QHttpServerConfiguration &lhs, const QHttpServerConfiguration &rhs)
Gibt true
zurück, wenn lhs und rhs den gleichen Satz an Konfigurationsparametern haben.
© 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.