QHttpServerConfiguration Class
QHttpServerConfiguration クラスは、サーバーのパラメータを制御します。詳細...
ヘッダ | #include <QHttpServerConfiguration> |
CMake: | find_package(Qt6 REQUIRED COMPONENTS HttpServer) target_link_libraries(mytarget PRIVATE Qt6::HttpServer) |
qmake: | QT += httpserver |
以来: | Qt 6.9 |
パブリック関数
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) |
関連する非メンバー
bool | operator!=(const QHttpServerConfiguration &lhs, const QHttpServerConfiguration &rhs) |
bool | operator==(const QHttpServerConfiguration &lhs, const QHttpServerConfiguration &rhs) |
メンバ関数の説明
QHttpServerConfiguration::QHttpServerConfiguration()
Default は QHttpServerConfiguration オブジェクトを構築します。
このような設定は以下の値を持ちます:
- レート制限は無効
QHttpServerConfiguration::QHttpServerConfiguration(const QHttpServerConfiguration &other)
この QHttpServerConfiguration をコピー構築します。
[noexcept]
QHttpServerConfiguration::QHttpServerConfiguration(QHttpServerConfiguration &&other)
からこの QHttpServerConfiguration を移動します。other
[noexcept]
QHttpServerConfiguration::~QHttpServerConfiguration()
破壊者。
[since 6.10]
QSpan<const std::pair<QHostAddress, int>> QHttpServerConfiguration::blacklist() const
QHttpServer によってアクセスが拒否されているサブネットのブラックリストを返します。
この関数は Qt 6.10 で導入されました。
setBlacklist()も参照してください 。
[since 6.10]
std::chrono::seconds QHttpServerConfiguration::keepAliveTimeout() const
QHttpServer が使用するキープアライブタイムアウトを返します。
この関数は Qt 6.10 で導入されました。
setKeepAliveTimeout()も参照してください 。
quint32 QHttpServerConfiguration::rateLimitPerSecond() const
サーバが受け付けた、IP ごとに 1 秒間に着信するリクエストの最大数を返します。
setRateLimitPerSecond()も参照 ください。
[since 6.10]
void QHttpServerConfiguration::setBlacklist(QSpan<const std::pair<QHostAddress, int>> subnetList)
subnetList をサブネットのブラックリストとして設定する。
このリストに含まれるIPアドレスは、QHttpServer からのアクセスを拒否される。ブラックリストは、ホワイトリストが空のときのみ有効です。
この関数は Qt 6.10 で導入されました。
blacklist(),setWhitelist(),QHostAddress::parseSubnet()も参照してください 。
[since 6.10]
void QHttpServerConfiguration::setKeepAliveTimeout(std::chrono::seconds timeout)
QHttpServer のキープアライブ・タイムアウトとしてtimeout を設定する。
keep-aliveタイムアウトは、アイドル状態の接続がクローズされるまでの時間 を決定する。デフォルトでは、タイムアウトは15秒に設定されています。
この関数は Qt 6.10 で導入されました。
keepAliveTimeout()も参照してください 。
void QHttpServerConfiguration::setRateLimitPerSecond(quint32 maxRequests)
QHttpServer が受け付ける、IPごとの1秒あたりの着信リクエストの最大数をmaxRequests に設定する。この制限を超えた場合、QHttpServer はQHttpServerResponder::StatusCode::TooManyRequests で応答する。
rateLimitPerSecond() およびQHttpServerResponder::StatusCodeも参照のこと 。
[since 6.10]
void QHttpServerConfiguration::setWhitelist(QSpan<const std::pair<QHostAddress, int>> subnetList)
許可されるサブネットのホワイトリストとしてsubnetList を設定する。
このリストが空でない場合、このリスト内のIPアドレスのみがQHttpServer によって許可される。ホワイトリストはブラックリストよりも優先されます。
各サブネットは、以下の組で表される:
- タイプQHostAddress のベースIPアドレス。
- サブネットマスクを定義するint型のCIDRプレフィックス長。
特定の IP アドレスのみを許可するには、IPv4 の場合はプレフィックス長を 32 (例:"192.168.1.100/32"
)、IPv6 の場合は 128 (例:"2001:db8::1/128"
)にします。
この関数は Qt 6.10 で導入されました。
whitelist(),setBlacklist(),QHostAddress::parseSubnet()も参照してください 。
[noexcept]
void QHttpServerConfiguration::swap(QHttpServerConfiguration &other)
このコンフィギュレーションをother と入れ替える。この操作は非常に速く、失敗することはない。
[since 6.10]
QSpan<const std::pair<QHostAddress, int>> QHttpServerConfiguration::whitelist() const
QHttpServer で許可されているサブネットのホワイトリストを返します。
この関数は Qt 6.10 で導入されました。
setWhitelist()も参照してください 。
[noexcept]
QHttpServerConfiguration &QHttpServerConfiguration::operator=(QHttpServerConfiguration &&other)
QHttpServerConfigurationMove-assignother 。
QHttpServerConfiguration &QHttpServerConfiguration::operator=(const QHttpServerConfiguration &other)
コピーアサインother QHttpServerConfiguration 。
関連 非会員
[noexcept]
bool operator!=(const QHttpServerConfiguration &lhs, const QHttpServerConfiguration &rhs)
lhs とrhs が同じコンフィギュレーション・パラメーター・セットを持っていない場合、true
を返す。
[noexcept]
bool operator==(const QHttpServerConfiguration &lhs, const QHttpServerConfiguration &rhs)
lhs とrhs が同じコンフィギュレーション・パラメーター・セットを持っている場合、true
を返す。
© 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.