PySide6.QtHttpServer.QHttpServerConfiguration

class QHttpServerConfiguration

The QHttpServerConfiguration class controls server parameters.

Added in version 6.9.

Synopsis

Methods

Note

This documentation may contain snippets that were automatically translated from C++ to Python. We always welcome contributions to the snippet translation. If you see an issue with the translation, you can also let us know by creating a ticket on https:/bugreports.qt.io/projects/PYSIDE

__init__()

Default constructs a QHttpServerConfiguration object.

Such a configuration has the following values:

  • Rate limit is disabled

__init__(other)
Parameters:

otherQHttpServerConfiguration

Copy-constructs this QHttpServerConfiguration .

keepAliveTimeout()
Return type:

std::chrono::seconds

Returns the keep-alive timeout used by QHttpServer .

maximumBodySize()
Return type:

int

Returns maximum size of the incoming body accepted by the server.

maximumHeaderFieldCount()
Return type:

int

Returns maximum number of incoming header fields accepted by the server.

maximumHeaderFieldSize()
Return type:

int

Returns maximum size of the incoming headers accepted by the server.

maximumTotalHeaderSize()
Return type:

int

Returns maximum size of the total incoming headers accepted by the server.

maximumUrlSize()
Return type:

int

Returns maximum size of the URL accepted by the server.

__ne__(rhs)
Parameters:

rhsQHttpServerConfiguration

Return type:

bool

__eq__(rhs)
Parameters:

rhsQHttpServerConfiguration

Return type:

bool

rateLimitPerSecond()
Return type:

int

Returns maximum number of incoming requests per second per IP accepted by the server.

setKeepAliveTimeout(timeout)
Parameters:

timeoutstd::chrono::seconds

Sets timeout as keep-alive timeout for QHttpServer .

The keep-alive timeout determines how long an idle connection is kept open before being closed. By default, the timeout is set to 15 seconds.

setMaximumBodySize(maxBodySize)
Parameters:

maxBodySize – int

Sets maxSize as the maximum size of the body that the server will accept. If the limit is exceeded, QHttpServer will respond with status 413 Content Too Large. If maxSize is -1 there is no limit. The default is 32 MiB.

setMaximumHeaderFieldCount(maxNumberOfHeaders)
Parameters:

maxNumberOfHeaders – int

Sets maxSize as the maximum number of header fields that the server will accept. If the limit is exceeded, QHttpServer will respond with status 431 Request Header Fields Too Large. If maxSize is -1 there is no limit. The default is 128.

setMaximumHeaderFieldSize(maxSingleHeaderSize)
Parameters:

maxSingleHeaderSize – int

Sets maxSize as the maximum size of a single header that the server will accept. If the limit is exceeded, QHttpServer will respond with status 431 Request Header Fields Too Large. If maxSize is -1 there is no limit. The default is 48 KiB.

setMaximumTotalHeaderSize(maxTotalHeadersSize)
Parameters:

maxTotalHeadersSize – int

Sets maxSize as the maximum total size of the headers that the server will accept. If the limit is exceeded, QHttpServer will respond with status 431 Request Header Fields Too Large. If maxSize is -1 there is no limit. The default is 64 KiB.

setMaximumUrlSize(maxUrlSize)
Parameters:

maxUrlSize – int

Sets maxSize as the maximum size of the URL that the server will accept. If the limit is exceeded, QHttpServer will respond with status 414 Request-URI Too Long. If maxSize is -1 there is no limit. The default is 64 KiB.

setRateLimitPerSecond(maxRequests)
Parameters:

maxRequests – int

Sets maxRequests as the maximum number of incoming requests per second per IP that will be accepted by QHttpServer . If the limit is exceeded, QHttpServer will respond with TooManyRequests .

swap(other)
Parameters:

otherQHttpServerConfiguration

Swaps this configuration with other. This operation is very fast and never fails.