QHttpServerConfiguration Class
La clase QHttpServerConfiguration controla los parametros del servidor. Más...
| Cabecera: | #include <QHttpServerConfiguration> |
| CMake: | find_package(Qt6 REQUIRED COMPONENTS HttpServer)target_link_libraries(mytarget PRIVATE Qt6::HttpServer) |
| qmake: | QT += httpserver |
| Desde: | Qt 6.9 |
Funciones Públicas
| 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 |
(since 6.11) qint64 | maximumBodySize() const |
(since 6.11) qint64 | maximumHeaderFieldCount() const |
(since 6.11) qint64 | maximumHeaderFieldSize() const |
(since 6.11) qint64 | maximumTotalHeaderSize() const |
(since 6.11) qint64 | maximumUrlSize() 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) |
(since 6.11) void | setMaximumBodySize(qint64 maxSize) |
(since 6.11) void | setMaximumHeaderFieldCount(qint64 maxSize) |
(since 6.11) void | setMaximumHeaderFieldSize(qint64 maxSize) |
(since 6.11) void | setMaximumTotalHeaderSize(qint64 maxSize) |
(since 6.11) void | setMaximumUrlSize(qint64 maxSize) |
| 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) |
No miembros relacionados
| bool | operator!=(const QHttpServerConfiguration &lhs, const QHttpServerConfiguration &rhs) |
| bool | operator==(const QHttpServerConfiguration &lhs, const QHttpServerConfiguration &rhs) |
Documentación de Funciones Miembro
QHttpServerConfiguration::QHttpServerConfiguration()
Default construye un objeto QHttpServerConfiguration.
Dicha configuración tiene los siguientes valores
- El límite de velocidad está desactivado
QHttpServerConfiguration::QHttpServerConfiguration(const QHttpServerConfiguration &other)
Copia-construye este QHttpServerConfiguration.
[constexpr noexcept] QHttpServerConfiguration::QHttpServerConfiguration(QHttpServerConfiguration &&other)
Mueve-construye esta QHttpServerConfiguration desde other
[noexcept] QHttpServerConfiguration::~QHttpServerConfiguration()
Destructor.
[since 6.10] QSpan<const std::pair<QHostAddress, int>> QHttpServerConfiguration::blacklist() const
Devuelve la lista negra de subredes a las que QHttpServer deniega el acceso.
Esta función se introdujo en Qt 6.10.
Véase también setBlacklist().
[since 6.10] std::chrono::seconds QHttpServerConfiguration::keepAliveTimeout() const
Devuelve el tiempo de espera keep-alive utilizado por QHttpServer.
Esta función se introdujo en Qt 6.10.
Véase también setKeepAliveTimeout().
[since 6.11] qint64 QHttpServerConfiguration::maximumBodySize() const
Devuelve el tamaño máximo del cuerpo entrante aceptado por el servidor.
Esta función se introdujo en Qt 6.11.
Véase también setMaximumBodySize().
[since 6.11] qint64 QHttpServerConfiguration::maximumHeaderFieldCount() const
Devuelve el número máximo de campos de cabecera entrantes aceptados por el servidor.
Esta función se introdujo en Qt 6.11.
Véase también setMaximumHeaderFieldCount().
[since 6.11] qint64 QHttpServerConfiguration::maximumHeaderFieldSize() const
Devuelve el tamaño máximo de las cabeceras entrantes aceptadas por el servidor.
Esta función se introdujo en Qt 6.11.
Véase también setMaximumHeaderFieldSize().
[since 6.11] qint64 QHttpServerConfiguration::maximumTotalHeaderSize() const
Devuelve el tamaño máximo del total de cabeceras entrantes aceptadas por el servidor.
Esta función se introdujo en Qt 6.11.
Véase también setMaximumTotalHeaderSize().
[since 6.11] qint64 QHttpServerConfiguration::maximumUrlSize() const
Devuelve el tamaño máximo de la URL aceptada por el servidor.
Esta función se introdujo en Qt 6.11.
Véase también setMaximumUrlSize().
quint32 QHttpServerConfiguration::rateLimitPerSecond() const
Devuelve el número máximo de peticiones entrantes por segundo por IP aceptadas por el servidor.
Véase también setRateLimitPerSecond().
[since 6.10] void QHttpServerConfiguration::setBlacklist(QSpan<const std::pair<QHostAddress, int>> subnetList)
Establece subnetList como lista negra de subredes.
A las direcciones IP de esta lista se les denegará el acceso a través de QHttpServer. La lista negra sólo está activa cuando la lista blanca está vacía.
Esta función se introdujo en Qt 6.10.
Véase también blacklist(), setWhitelist(), y QHostAddress::parseSubnet().
[since 6.10] void QHttpServerConfiguration::setKeepAliveTimeout(std::chrono::seconds timeout)
Establece timeout como tiempo de espera para mantener la conexión activa para QHttpServer.
El tiempo de espera "keep-alive" determina cuánto tiempo se mantiene abierta una conexión inactiva antes de cerrarse. Por defecto, el tiempo de espera se establece en 15 segundos.
Esta función se introdujo en Qt 6.10.
Véase también keepAliveTimeout().
[since 6.11] void QHttpServerConfiguration::setMaximumBodySize(qint64 maxSize)
Establece maxSize como el tamaño máximo del cuerpo que aceptará el servidor. Si se excede el límite, QHttpServer responderá con el estado 413 Contenido demasiado grande. Si maxSize es -1 no hay límite. El valor por defecto es 32 MiB.
Esta función se introdujo en Qt 6.11.
Véase también maximumBodySize() y QHttpServerResponder::StatusCode.
[since 6.11] void QHttpServerConfiguration::setMaximumHeaderFieldCount(qint64 maxSize)
Establece maxSize como el número máximo de campos de cabecera que aceptará el servidor. Si se excede el límite, QHttpServer responderá con el estado 431 Request Header Fields Too Large. Si maxSize es -1 no hay límite. El valor por defecto es 128.
Esta función se introdujo en Qt 6.11.
Véase también maximumHeaderFieldCount() y QHttpServerResponder::StatusCode.
[since 6.11] void QHttpServerConfiguration::setMaximumHeaderFieldSize(qint64 maxSize)
Establece maxSize como el tamaño máximo de una sola cabecera que aceptará el servidor. Si se excede el límite, QHttpServer responderá con el estado 431 Request Header Fields Too Large. Si maxSize es -1 no hay límite. El valor por defecto es 48 KiB.
Esta función se introdujo en Qt 6.11.
Véase también maximumHeaderFieldSize() y QHttpServerResponder::StatusCode.
[since 6.11] void QHttpServerConfiguration::setMaximumTotalHeaderSize(qint64 maxSize)
Establece maxSize como el tamaño total máximo de las cabeceras que aceptará el servidor. Si se excede el límite, QHttpServer responderá con el estado 431 Request Header Fields Too Large. Si maxSize es -1 no hay límite. El valor por defecto es 64 KiB.
Esta función se introdujo en Qt 6.11.
Véase también maximumTotalHeaderSize() y QHttpServerResponder::StatusCode.
[since 6.11] void QHttpServerConfiguration::setMaximumUrlSize(qint64 maxSize)
Establece maxSize como el tamaño máximo de la URL que aceptará el servidor. Si se excede el límite, QHttpServer responderá con el estado 414 Request-URI Too Long. Si maxSize es -1 no hay límite. El valor por defecto es 64 KiB.
Esta función se introdujo en Qt 6.11.
Véase también maximumUrlSize() y QHttpServerResponder::StatusCode.
void QHttpServerConfiguration::setRateLimitPerSecond(quint32 maxRequests)
Establece maxRequests como el número máximo de peticiones entrantes por segundo por IP que serán aceptadas por QHttpServer. Si se excede el límite, QHttpServer responderá con QHttpServerResponder::StatusCode::TooManyRequests.
Véase también rateLimitPerSecond() y QHttpServerResponder::StatusCode.
[since 6.10] void QHttpServerConfiguration::setWhitelist(QSpan<const std::pair<QHostAddress, int>> subnetList)
Establece subnetList como la lista blanca de subredes permitidas.
Cuando la lista no está vacía, sólo las direcciones IP de esta lista serán permitidas por QHttpServer. La lista blanca tiene prioridad sobre la lista negra.
Cada subred se representa como un par formado por:
- Una dirección IP base del tipo QHostAddress.
- Una longitud de prefijo CIDR de tipo int, que define la máscara de subred.
Para permitir sólo una dirección IP específica, utilice una longitud de prefijo de 32 para IPv4 (por ejemplo, "192.168.1.100/32") o 128 para IPv6 (por ejemplo, "2001:db8::1/128").
Esta función se introdujo en Qt 6.10.
Véase también whitelist(), setBlacklist() y QHostAddress::parseSubnet().
[noexcept] void QHttpServerConfiguration::swap(QHttpServerConfiguration &other)
Intercambia esta configuración con other. Esta operación es muy rápida y nunca falla.
[since 6.10] QSpan<const std::pair<QHostAddress, int>> QHttpServerConfiguration::whitelist() const
Devuelve la lista blanca de subredes permitidas por QHttpServer.
Esta función se introdujo en Qt 6.10.
Véase también setWhitelist().
[noexcept] QHttpServerConfiguration &QHttpServerConfiguration::operator=(QHttpServerConfiguration &&other)
Mover-asigna other a este QHttpServerConfiguration.
QHttpServerConfiguration &QHttpServerConfiguration::operator=(const QHttpServerConfiguration &other)
Copia-asigna other a este QHttpServerConfiguration.
Relacionados No miembros
[noexcept] bool operator!=(const QHttpServerConfiguration &lhs, const QHttpServerConfiguration &rhs)
Devuelve true si lhs y rhs no tienen el mismo conjunto de parámetros de configuración.
[noexcept] bool operator==(const QHttpServerConfiguration &lhs, const QHttpServerConfiguration &rhs)
Devuelve true si lhs y rhs tienen el mismo conjunto de parámetros de configuración.
© 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.