Skip to content

Commit e80ecdb

Browse files
committed
Add connection limits, require Qt 6.12 and update submodules
1 parent d4b022b commit e80ecdb

10 files changed

Lines changed: 94 additions & 9 deletions

File tree

‎.github/workflows/ci.yml‎

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -20,12 +20,12 @@ jobs:
2020
arch: x86_64
2121
qt_host: linux
2222
qt_arch: linux_gcc_64
23-
qt_version: '6.11.1'
23+
qt_version: '6.12.0'
2424
- os: macos-latest
2525
arch: arm64
2626
qt_host: mac
2727
qt_arch: clang_64
28-
qt_version: '6.11.1'
28+
qt_version: '6.12.0'
2929

3030
runs-on: ${{ matrix.os }}
3131

‎src/CMakeLists.txt‎

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
cmake_minimum_required(VERSION 3.21)
1+
cmake_minimum_required(VERSION 3.25)
22
project(RangeCloud)
33

44
set(CMAKE_CXX_STANDARD 20)
@@ -18,7 +18,7 @@ endif()
1818

1919
set(BUILD_SHARED_LIBS OFF)
2020

21-
find_package(Qt6 6.10 REQUIRED COMPONENTS Core Concurrent HttpServer Network LinguistTools)
21+
find_package(Qt6 6.12 REQUIRED COMPONENTS Core Concurrent HttpServer Network LinguistTools)
2222
qt_standard_project_setup()
2323

2424
add_library(common_defines INTERFACE)

‎src/Config.cmake‎

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
set(PROJECT_VERSION "1.1.0")
1+
set(PROJECT_VERSION "1.2.0")
22
set(PROJECT_YEAR "2026")
33
set(PROJECT_RELEASE_DATE "2026-08-12")
44
set(PROJECT_PACKAGE_NAME "range-cloud")

‎src/cloud/doc/RELEASE_NOTES.md‎

Lines changed: 21 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,24 @@
1+
## Version 1.2.0
2+
3+
### Improvements
4+
5+
- New configuration settings: `maxConnections` (default 1000) and `maxConnectionsPerHost` (default 20) limit simultaneous connections to the HTTP servers
6+
- `maxBodySize`, `maxConnections` and `maxConnectionsPerHost` are now applied to both public and private HTTP servers
7+
- Qt 6.12 is now the minimum required version (CMake 3.25 minimum); CI builds with Qt 6.12.0
8+
9+
### Bug Fixes
10+
11+
- `maxBodySize` default was read from an uninitialized value when not set in the configuration file
12+
13+
### Submodules
14+
15+
- range-ai-lib @ v1.1.0
16+
- range-base-lib @ v1.1.0
17+
- range-build-tools @ v1.0.0
18+
- range-cloud-lib @ v1.1.1
19+
20+
---
21+
122
## Version 1.1.0
223

324
### Improvements

‎src/cloud/src/application.cpp‎

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -396,6 +396,9 @@ void Application::onStarted()
396396
configuration.getPrivateKeyPassword()));
397397
publicHttpServerSettings.setTlsTrustStore(RTlsTrustStore(configuration.getCaPublicKey()));
398398
publicHttpServerSettings.setRateLimitPerSecond(configuration.getRateLimitPerSecond());
399+
publicHttpServerSettings.setMaxBodySize(configuration.getMaxBodySize());
400+
publicHttpServerSettings.setMaxConnections(configuration.getMaxConnections());
401+
publicHttpServerSettings.setMaxConnectionsPerHost(configuration.getMaxConnectionsPerHost());
399402

400403
this->publicHttpServer = new RHttpServer(RHttpServer::Public,publicHttpServerSettings);
401404
this->publicHttpServer->setAuthTokenValidator(this->userManager->getAuthTokenValidator());
@@ -416,6 +419,9 @@ void Application::onStarted()
416419
configuration.getPrivateKeyPassword()));
417420
privateHttpServerSettings.setTlsTrustStore(RTlsTrustStore(configuration.getCaPublicKey()));
418421
privateHttpServerSettings.setRateLimitPerSecond(configuration.getRateLimitPerSecond());
422+
privateHttpServerSettings.setMaxBodySize(configuration.getMaxBodySize());
423+
privateHttpServerSettings.setMaxConnections(configuration.getMaxConnections());
424+
privateHttpServerSettings.setMaxConnectionsPerHost(configuration.getMaxConnectionsPerHost());
419425

420426
this->privateHttpServer = new RHttpServer(RHttpServer::Private,privateHttpServerSettings);
421427

‎src/cloud/src/configuration.cpp‎

Lines changed: 45 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -43,6 +43,8 @@ void Configuration::_init(const Configuration *pConfiguration)
4343
this->privateHttpPort = pConfiguration->privateHttpPort;
4444
this->rateLimitPerSecond = pConfiguration->rateLimitPerSecond;
4545
this->maxBodySize = pConfiguration->maxBodySize;
46+
this->maxConnections = pConfiguration->maxConnections;
47+
this->maxConnectionsPerHost = pConfiguration->maxConnectionsPerHost;
4648
this->publicKey = pConfiguration->publicKey;
4749
this->privateKey = pConfiguration->privateKey;
4850
this->privateKeyPassword = pConfiguration->privateKeyPassword;
@@ -69,7 +71,9 @@ Configuration::Configuration(const QString &cloudDirectory)
6971
, publicHttpPort{Configuration::getDefaultPublicHttpPort()}
7072
, privateHttpPort{Configuration::getDefaultPrivateHttpPort()}
7173
, rateLimitPerSecond{Configuration::getDefaultRateLimitPerSecond()}
72-
, maxBodySize{Configuration::getMaxBodySize()}
74+
, maxBodySize{Configuration::getDefaultMaxBodySize()}
75+
, maxConnections{Configuration::getDefaultMaxConnections()}
76+
, maxConnectionsPerHost{Configuration::getDefaultMaxConnectionsPerHost()}
7377
, publicKey{Configuration::getDefaultPublicKeyPath(this->cloudDirectory)}
7478
, privateKey{Configuration::getDefaultPrivateKeyPath(this->cloudDirectory)}
7579
, privateKeyPassword{QString()}
@@ -161,6 +165,26 @@ void Configuration::setMaxBodySize(qint64 maxBodySize)
161165
this->maxBodySize = maxBodySize;
162166
}
163167

168+
quint32 Configuration::getMaxConnections() const
169+
{
170+
return this->maxConnections;
171+
}
172+
173+
void Configuration::setMaxConnections(quint32 maxConnections)
174+
{
175+
this->maxConnections = maxConnections;
176+
}
177+
178+
quint32 Configuration::getMaxConnectionsPerHost() const
179+
{
180+
return this->maxConnectionsPerHost;
181+
}
182+
183+
void Configuration::setMaxConnectionsPerHost(quint32 maxConnectionsPerHost)
184+
{
185+
this->maxConnectionsPerHost = maxConnectionsPerHost;
186+
}
187+
164188
const QString &Configuration::getPublicKey() const
165189
{
166190
return this->publicKey;
@@ -437,6 +461,14 @@ void Configuration::fromJson(const QJsonObject &json)
437461
{
438462
this->maxBodySize = v.toString().toLongLong();
439463
}
464+
if (const QJsonValue &v = json["maxConnections"]; v.isString())
465+
{
466+
this->maxConnections = v.toString().toUInt();
467+
}
468+
if (const QJsonValue &v = json["maxConnectionsPerHost"]; v.isString())
469+
{
470+
this->maxConnectionsPerHost = v.toString().toUInt();
471+
}
440472
if (const QJsonValue &v = json["publicKey"]; v.isString())
441473
{
442474
this->publicKey = v.toString();
@@ -517,6 +549,8 @@ QJsonObject Configuration::toJson() const
517549
json["privateHttpPort"] = QString::number(this->privateHttpPort);
518550
json["rateLimitPerSecond"] = QString::number(this->rateLimitPerSecond);
519551
json["maxBodySize"] = QString::number(this->maxBodySize);
552+
json["maxConnections"] = QString::number(this->maxConnections);
553+
json["maxConnectionsPerHost"] = QString::number(this->maxConnectionsPerHost);
520554
json["publicKey"] = this->publicKey;
521555
json["privateKey"] = this->privateKey;
522556
json["privateKeyPassword"] = this->privateKeyPassword;
@@ -716,6 +750,16 @@ qint64 Configuration::getDefaultMaxBodySize()
716750
return RHttpServerSettings::defaultMaxBodySize;
717751
}
718752

753+
quint32 Configuration::getDefaultMaxConnections()
754+
{
755+
return RHttpServerSettings::defaultMaxConnections;
756+
}
757+
758+
quint32 Configuration::getDefaultMaxConnectionsPerHost()
759+
{
760+
return RHttpServerSettings::defaultMaxConnectionsPerHost;
761+
}
762+
719763
QString Configuration::getDefaultPrivateKeyPath(const QString &cloudDirectoryPath)
720764
{
721765
return QDir(Configuration::buildServerCertificateDirectoryPath(cloudDirectoryPath)).absoluteFilePath("server.key.pem");

‎src/cloud/src/configuration.h‎

Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -43,6 +43,8 @@ class Configuration
4343

4444
quint32 rateLimitPerSecond;
4545
qint64 maxBodySize;
46+
quint32 maxConnections;
47+
quint32 maxConnectionsPerHost;
4648

4749
QString publicKey;
4850
QString privateKey;
@@ -95,6 +97,12 @@ class Configuration
9597
qint64 getMaxBodySize() const;
9698
void setMaxBodySize(qint64 maxBodySize);
9799

100+
quint32 getMaxConnections() const;
101+
void setMaxConnections(quint32 maxConnections);
102+
103+
quint32 getMaxConnectionsPerHost() const;
104+
void setMaxConnectionsPerHost(quint32 maxConnectionsPerHost);
105+
98106
const QString &getPublicKey() const;
99107
void setPublicKey(const QString &publicKey);
100108

@@ -288,6 +296,12 @@ class Configuration
288296
//! Get default maximum maximum body size accepted by the server.
289297
static qint64 getDefaultMaxBodySize();
290298

299+
//! Get default maximum number of simultaneous connections accepted by the server.
300+
static quint32 getDefaultMaxConnections();
301+
302+
//! Get default maximum number of simultaneous connections per host (IP) accepted by the server.
303+
static quint32 getDefaultMaxConnectionsPerHost();
304+
291305
//! Get default private key file path.
292306
static QString getDefaultPrivateKeyPath(const QString &cloudDirectoryPath = Configuration::getDefaultCloudDirectoryPath());
293307

‎src/range-base-lib‎

0 commit comments

Comments
 (0)