cutelyst 5.0.1
A C++ Web Framework built on top of Qt, using the simple approach of Catalyst (Perl) framework.
Cutelyst::Server Class Reference

Implements a web server. More...

#include <Cutelyst/Server/server.h>

Inheritance diagram for Cutelyst::Server:

Signals

void changed ()
void errorOccured (const QString &error)
void ready ()
void stopped ()

Public Member Functions

 Server (QObject *parent=nullptr)
virtual ~Server ()
QString application () const
bool autoReload () const
int bufferSize () const
QString chdir () const
QString chdir2 () const
QString chownSocket () const
QVariantMap config () const noexcept
int cpuAffinity () const
int exec (Cutelyst::Application *app=nullptr)
QStringList fastcgiSocket () const
QString gid () const
quint32 http2HeaderTableSize () const
QStringList http2Socket () const
bool httpsH2 () const
QStringList httpSocket () const
QStringList httpsSocket () const
QStringList ini () const
QStringList json () const
bool lazy () const
int listenQueue () const
bool master () const
bool noInitgroups () const
void parseCommandLine (const QStringList &args)
QString pidfile () const
QString pidfile2 () const
qint64 postBuffering () const
qint64 postBufferingBufsize () const
QString processes () const
bool reusePort () const
void setApplication (const QString &application)
void setAutoReload (bool enable)
void setBufferSize (int size)
void setChdir (const QString &chdir)
void setChdir2 (const QString &chdir2)
void setChownSocket (const QString &chownSocket)
void setCpuAffinity (int value)
void setFastcgiSocket (const QStringList &fastcgiSocket)
void setGid (const QString &gid)
void setHttp2HeaderTableSize (quint32 headerTableSize)
void setHttp2Socket (const QStringList &http2Socket)
void setHttpsH2 (bool enable)
void setHttpSocket (const QStringList &httpSocket)
void setHttpsSocket (const QStringList &httpsSocket)
void setIni (const QStringList &files)
void setJson (const QStringList &files)
void setLazy (bool enable)
void setListenQueue (int size)
void setMaster (bool enable)
void setNoInitgroups (bool enable)
void setPidfile (const QString &file)
void setPidfile2 (const QString &file)
void setPostBuffering (qint64 size)
void setPostBufferingBufsize (qint64 size)
void setProcesses (const QString &process)
void setReusePort (bool enable)
void setSocketAccess (const QString &socketAccess)
void setSocketRcvbuf (int value)
void setSocketSndbuf (int value)
void setSocketTimeout (int timeout)
void setSoKeepalive (bool enable)
void setStaticMap (const QStringList &staticMap)
void setStaticMap2 (const QStringList &staticMap)
void setTcpNodelay (bool enable)
void setThreads (const QString &threads)
void setTouchReload (const QStringList &files)
void setUid (const QString &uid)
void setUmask (const QString &value)
void setUpgradeH2c (bool enable)
void setUsingFrontendProxy (bool enable)
void setWebsocketMaxSize (int value)
QString socketAccess () const
int socketRcvbuf () const
int socketSndbuf () const
int socketTimeout () const
bool soKeepalive () const
bool start (Cutelyst::Application *app=nullptr)
QStringList staticMap () const
QStringList staticMap2 () const
void stop ()
bool tcpNodelay () const
QString threads () const
QStringList touchReload () const
QString uid () const
QString umask () const
bool upgradeH2c () const
bool usingFrontendProxy () const
int websocketMaxSize () const
Public Member Functions inherited from QObject
 QObject (QObject *parent)
QBindable< QStringbindableObjectName ()
bool blockSignals (bool block)
const QObjectListchildren () const const
QMetaObject::Connection connect (const QObject *sender, const char *signal, const char *method, Qt::ConnectionType type) const const
void deleteLater ()
void destroyed (QObject *obj)
bool disconnect (const char *signal, const QObject *receiver, const char *method) const const
bool disconnect (const QObject *receiver, const char *method) const const
void dumpObjectInfo () const const
void dumpObjectTree () const const
QList< QByteArraydynamicPropertyNames () const const
virtual bool event (QEvent *e)
virtual bool eventFilter (QObject *watched, QEvent *event)
findChild (QAnyStringView name, Qt::FindChildOptions options) const const
findChild (Qt::FindChildOptions options) const const
QList< T > findChildren (const QRegularExpression &re, Qt::FindChildOptions options) const const
QList< T > findChildren (QAnyStringView name, Qt::FindChildOptions options) const const
QList< T > findChildren (Qt::FindChildOptions options) const const
bool inherits (const char *className) const const
void installEventFilter (QObject *filterObj)
bool isQmlExposed () const const
bool isQuickItemType () const const
bool isWidgetType () const const
bool isWindowType () const const
void killTimer (int id)
void killTimer (Qt::TimerId id)
virtual const QMetaObjectmetaObject () const const
bool moveToThread (QThread *targetThread)
QString objectName () const const
void objectNameChanged (const QString &objectName)
QObjectparent () const const
QVariant property (const char *name) const const
 Q_CLASSINFO (Name, Value)
 Q_EMIT Q_EMIT
 Q_ENUM (...)
 Q_ENUM_NS (...)
 Q_ENUMS (...)
 Q_FLAG (...)
 Q_FLAG_NS (...)
 Q_FLAGS (...)
 Q_GADGET Q_GADGET
 Q_GADGET_EXPORT (EXPORT_MACRO)
 Q_INTERFACES (...)
 Q_INVOKABLE Q_INVOKABLE
 Q_MOC_INCLUDE Q_MOC_INCLUDE
 Q_NAMESPACE Q_NAMESPACE
 Q_NAMESPACE_EXPORT (EXPORT_MACRO)
 Q_OBJECT Q_OBJECT
 Q_PROPERTY (...)
 Q_REVISION Q_REVISION
 Q_SET_OBJECT_NAME (Object)
 Q_SIGNAL Q_SIGNAL
 Q_SIGNALS Q_SIGNALS
 Q_SLOT Q_SLOT
 Q_SLOTS Q_SLOTS
qobject_cast (const QObject *object)
qobject_cast (QObject *object)
 QT_NO_CONTEXTLESS_CONNECT QT_NO_CONTEXTLESS_CONNECT
 QT_NO_NARROWING_CONVERSIONS_IN_CONNECT QT_NO_NARROWING_CONVERSIONS_IN_CONNECT
void removeEventFilter (QObject *obj)
void setObjectName (const QString &name)
void setObjectName (QAnyStringView name)
void setParent (QObject *parent)
bool setProperty (const char *name, const QVariant &value)
bool setProperty (const char *name, QVariant &&value)
bool signalsBlocked () const const
int startTimer (int interval, Qt::TimerType timerType)
int startTimer (std::chrono::nanoseconds interval, Qt::TimerType timerType)
QThreadthread () const const

Properties

QString application
bool auto_reload
int buffer_size
QString chdir
QString chdir2
QString chown_socket
int cpu_affinity
QStringList fastcgi_socket
QString gid
quint32 http2_header_table_size
QStringList http2_socket
QStringList http_socket
bool https_h2
QStringList https_socket
QStringList ini
QStringList json
bool lazy
int listen
bool master
bool no_initgroups
QString pidfile
QString pidfile2
qint64 post_buffering
qint64 post_buffering_bufsize
QString processes
bool reuse_port
bool so_keepalive
QString socket_access
int socket_rcvbuf
int socket_sndbuf
int socket_timeout
QStringList static_map
QStringList static_map2
bool tcp_nodelay
QString threads
QStringList touch_reload
QString uid
QString umask
bool upgrade_h2c
bool using_frontend_proxy
int websocket_max_size
Properties inherited from QObject
 objectName

Additional Inherited Members

Public Types inherited from QObject
enum  TimerId
Static Public Member Functions inherited from QObject
QMetaObject::Connection connect (const QObject *sender, const char *signal, const QObject *receiver, const char *method, Qt::ConnectionType type)
QMetaObject::Connection connect (const QObject *sender, const QMetaMethod &signal, const QObject *receiver, const QMetaMethod &method, Qt::ConnectionType type)
QMetaObject::Connection connect (const QObject *sender, PointerToMemberFunction signal, const QObject *context, Functor functor, Qt::ConnectionType type)
QMetaObject::Connection connect (const QObject *sender, PointerToMemberFunction signal, const QObject *receiver, PointerToMemberFunction method, Qt::ConnectionType type)
QMetaObject::Connection connect (const QObject *sender, PointerToMemberFunction signal, Functor functor)
bool disconnect (const QMetaObject::Connection &connection)
bool disconnect (const QObject *sender, const char *signal, const QObject *receiver, const char *method)
bool disconnect (const QObject *sender, const QMetaMethod &signal, const QObject *receiver, const QMetaMethod &method)
bool disconnect (const QObject *sender, PointerToMemberFunction signal, const QObject *receiver, PointerToMemberFunction method)
QString tr (const char *sourceText, const char *disambiguation, int n)
Public Attributes inherited from QObject
 Invalid
typedef QObjectList
Protected Member Functions inherited from QObject
virtual void childEvent (QChildEvent *event)
virtual void connectNotify (const QMetaMethod &signal)
virtual void customEvent (QEvent *event)
virtual void disconnectNotify (const QMetaMethod &signal)
bool isSignalConnected (const QMetaMethod &signal) const const
int receivers (const char *signal) const const
QObjectsender () const const
int senderSignalIndex () const const
virtual void timerEvent (QTimerEvent *event)

Detailed Description

The Server class implements a web server that can either act on it’s own or behind another server like nginx or Apache. This class is used by cutelystd5-qt6 but can also be integrated into your own application to start() and stop() a Cutelyst server.

Configuration file options

All command line options from cutelystd5-qt6 have their counterparts as properties of this class. Using the server section of your application configuration file you can set this properties via configuration file options. Simply use the property names as configuration keys.

Example

[server]
http_socket="localhost:3001"
threads=4

Logging

The Cutelyst server uses the following logging categories:

  • cutelyst.server
  • cutelyst.server.engine
  • cutelyst.server.fork
  • cutelyst.server.proto
  • cutelyst.server.fcgi
  • cutelyst.server.http
  • cutelyst.server.http2
  • cutelyst.server.websocket
  • cutelyst.server.socket
  • cutelyst.server.staticmap
  • cutelyst.server.systemd
  • cutelyst.server.tcp
  • cutelyst.server.tcpbalancer
  • cutelyst.server.unix
  • cutelyst.server.windows
See also
Logging with Cutelyst

Definition at line 59 of file server.h.

Constructor & Destructor Documentation

◆ Server()

Server::Server ( QObject * parent = nullptr)
explicit

Constructs a new Server object with the given parent.

Note
When on Linux the constructor will try install our EPoll event loop, so creating this class must be done before creating a QCoreApplition or any of it’s subclasses.

Definition at line 45 of file server.cpp.

References QObject::QObject(), Server(), QCoreApplication::addLibraryPath(), QObject::connect(), errorOccured(), QObject::parent(), QCoreApplication::setEventDispatcher(), and stopped().

Referenced by Server(), config(), exec(), parseCommandLine(), start(), and stop().

◆ ~Server()

Server::~Server ( )
virtual

Destroys the Server object.

Definition at line 89 of file server.cpp.

Member Function Documentation

◆ application()

QString Server::application ( ) const
nodiscard

Definition at line 1068 of file server.cpp.

◆ autoReload()

bool Server::autoReload ( ) const
nodiscard

Definition at line 1361 of file server.cpp.

◆ bufferSize()

int Server::bufferSize ( ) const
nodiscard

Definition at line 1404 of file server.cpp.

◆ changed

void Cutelyst::Server::changed ( )
signal

It is emitted once config changes.

References changed().

Referenced by changed().

◆ chdir()

QString Server::chdir ( ) const
nodiscard

Definition at line 1123 of file server.cpp.

◆ chdir2()

QString Server::chdir2 ( ) const
nodiscard

Definition at line 1253 of file server.cpp.

◆ chownSocket()

QString Server::chownSocket ( ) const
nodiscard

Definition at line 1585 of file server.cpp.

◆ config()

QVariantMap Server::config ( ) const
nodiscardnoexcept

Returns the configuration set by setIni() and setJson().

Since
Cutelyst 4.0.0

Definition at line 1664 of file server.cpp.

References Server().

◆ cpuAffinity()

int Server::cpuAffinity ( ) const
nodiscard

Definition at line 1615 of file server.cpp.

◆ errorOccured

void Cutelyst::Server::errorOccured ( const QString & error)
signal

It is emitted once error occurs.

References errorOccured().

Referenced by Server(), errorOccured(), exec(), and start().

◆ exec()

int Server::exec ( Cutelyst::Application * app = nullptr)

This function will start the server.

If an application app is provided, it will ignore the value of setApplication and/or the application configuration key in case ini or json is set, meaning it won’t dynamically load an Application but use this to create new instances (if the app constructor is marked as Q_INVOKABLE and threads settings are greater than 1).

It will return 0 in case of sucess.

Note
This method calls QCoreApplication::exec() internally, this is needed because when creating or recreating child process the event loop must not be running otherwise we get undefined behavior. So exit main after this function.
This method does not take ownership of application app.

Definition at line 678 of file server.cpp.

References Server(), QObject::connect(), Qt::DirectConnection, errorOccured(), QString::fromLatin1(), QThread::idealThreadCount(), QObject::Q_EMIT(), ready(), and QDir::setCurrent().

Referenced by start().

◆ fastcgiSocket()

QStringList Server::fastcgiSocket ( ) const
nodiscard

Definition at line 1214 of file server.cpp.

◆ gid()

QString Server::gid ( ) const
nodiscard

Definition at line 1555 of file server.cpp.

◆ http2HeaderTableSize()

quint32 Server::http2HeaderTableSize ( ) const
nodiscard

Definition at line 1162 of file server.cpp.

◆ http2Socket()

QStringList Server::http2Socket ( ) const
nodiscard

Definition at line 1149 of file server.cpp.

◆ httpsH2()

bool Server::httpsH2 ( ) const
nodiscard

Definition at line 1188 of file server.cpp.

◆ httpSocket()

QStringList Server::httpSocket ( ) const
nodiscard

Definition at line 1136 of file server.cpp.

◆ httpsSocket()

QStringList Server::httpsSocket ( ) const
nodiscard

Definition at line 1201 of file server.cpp.

◆ ini()

QStringList Server::ini ( ) const
nodiscard

Definition at line 1279 of file server.cpp.

◆ json()

QStringList Server::json ( ) const
nodiscard

Definition at line 1305 of file server.cpp.

◆ lazy()

bool Server::lazy ( ) const
nodiscard

Definition at line 1645 of file server.cpp.

◆ listenQueue()

int Server::listenQueue ( ) const
nodiscard

Definition at line 1387 of file server.cpp.

◆ master()

bool Server::master ( ) const
nodiscard

Definition at line 1346 of file server.cpp.

◆ noInitgroups()

bool Server::noInitgroups ( ) const
nodiscard

Definition at line 1570 of file server.cpp.

◆ parseCommandLine()

◆ pidfile()

QString Server::pidfile ( ) const
nodiscard

Definition at line 1512 of file server.cpp.

◆ pidfile2()

QString Server::pidfile2 ( ) const
nodiscard

Definition at line 1525 of file server.cpp.

◆ postBuffering()

qint64 Server::postBuffering ( ) const
nodiscard

Definition at line 1417 of file server.cpp.

◆ postBufferingBufsize()

qint64 Server::postBufferingBufsize ( ) const
nodiscard

Definition at line 1434 of file server.cpp.

◆ processes()

QString Server::processes ( ) const
nodiscard

Definition at line 1107 of file server.cpp.

◆ ready

void Cutelyst::Server::ready ( )
signal

It is emitted once the server is ready.

References QObject::Q_SIGNALS(), and ready().

Referenced by exec(), and ready().

◆ reusePort()

bool Server::reusePort ( ) const
nodiscard

Definition at line 1632 of file server.cpp.

◆ setApplication()

void Server::setApplication ( const QString & application)

Definition at line 1053 of file server.cpp.

◆ setAutoReload()

void Server::setAutoReload ( bool enable)

Definition at line 1352 of file server.cpp.

◆ setBufferSize()

void Server::setBufferSize ( int size)

Definition at line 1393 of file server.cpp.

◆ setChdir()

void Server::setChdir ( const QString & chdir)

Definition at line 1116 of file server.cpp.

◆ setChdir2()

void Server::setChdir2 ( const QString & chdir2)

Definition at line 1246 of file server.cpp.

◆ setChownSocket()

void Server::setChownSocket ( const QString & chownSocket)

Definition at line 1576 of file server.cpp.

◆ setCpuAffinity()

void Server::setCpuAffinity ( int value)

Definition at line 1606 of file server.cpp.

◆ setFastcgiSocket()

void Server::setFastcgiSocket ( const QStringList & fastcgiSocket)

Definition at line 1207 of file server.cpp.

◆ setGid()

void Server::setGid ( const QString & gid)

Definition at line 1546 of file server.cpp.

◆ setHttp2HeaderTableSize()

void Server::setHttp2HeaderTableSize ( quint32 headerTableSize)

Definition at line 1155 of file server.cpp.

◆ setHttp2Socket()

void Server::setHttp2Socket ( const QStringList & http2Socket)

Definition at line 1142 of file server.cpp.

◆ setHttpsH2()

void Server::setHttpsH2 ( bool enable)

Definition at line 1181 of file server.cpp.

◆ setHttpSocket()

void Server::setHttpSocket ( const QStringList & httpSocket)

Definition at line 1129 of file server.cpp.

◆ setHttpsSocket()

void Server::setHttpsSocket ( const QStringList & httpsSocket)

Definition at line 1194 of file server.cpp.

◆ setIni()

void Server::setIni ( const QStringList & files)

Definition at line 1259 of file server.cpp.

◆ setJson()

void Server::setJson ( const QStringList & files)

Definition at line 1285 of file server.cpp.

◆ setLazy()

void Server::setLazy ( bool enable)

Definition at line 1638 of file server.cpp.

◆ setListenQueue()

void Server::setListenQueue ( int size)

Definition at line 1380 of file server.cpp.

◆ setMaster()

void Server::setMaster ( bool enable)

Definition at line 1337 of file server.cpp.

◆ setNoInitgroups()

void Server::setNoInitgroups ( bool enable)

Definition at line 1561 of file server.cpp.

◆ setPidfile()

void Server::setPidfile ( const QString & file)

Definition at line 1505 of file server.cpp.

◆ setPidfile2()

void Server::setPidfile2 ( const QString & file)

Definition at line 1518 of file server.cpp.

◆ setPostBuffering()

void Server::setPostBuffering ( qint64 size)

Definition at line 1410 of file server.cpp.

◆ setPostBufferingBufsize()

void Server::setPostBufferingBufsize ( qint64 size)

Definition at line 1423 of file server.cpp.

◆ setProcesses()

void Server::setProcesses ( const QString & process)

Definition at line 1094 of file server.cpp.

◆ setReusePort()

void Server::setReusePort ( bool enable)

Definition at line 1621 of file server.cpp.

◆ setSocketAccess()

void Server::setSocketAccess ( const QString & socketAccess)

Definition at line 1220 of file server.cpp.

◆ setSocketRcvbuf()

void Server::setSocketRcvbuf ( int value)

Definition at line 1479 of file server.cpp.

◆ setSocketSndbuf()

void Server::setSocketSndbuf ( int value)

Definition at line 1466 of file server.cpp.

◆ setSocketTimeout()

void Server::setSocketTimeout ( int timeout)

Definition at line 1233 of file server.cpp.

◆ setSoKeepalive()

void Server::setSoKeepalive ( bool enable)

Definition at line 1453 of file server.cpp.

◆ setStaticMap()

void Server::setStaticMap ( const QStringList & staticMap)

Definition at line 1311 of file server.cpp.

◆ setStaticMap2()

void Server::setStaticMap2 ( const QStringList & staticMap)

Definition at line 1324 of file server.cpp.

◆ setTcpNodelay()

void Server::setTcpNodelay ( bool enable)

Definition at line 1440 of file server.cpp.

◆ setThreads()

void Server::setThreads ( const QString & threads)

Definition at line 1074 of file server.cpp.

◆ setTouchReload()

void Server::setTouchReload ( const QStringList & files)

Definition at line 1367 of file server.cpp.

◆ setUid()

void Server::setUid ( const QString & uid)

Definition at line 1531 of file server.cpp.

◆ setUmask()

void Server::setUmask ( const QString & value)

Definition at line 1591 of file server.cpp.

◆ setUpgradeH2c()

void Server::setUpgradeH2c ( bool enable)

Definition at line 1168 of file server.cpp.

◆ setUsingFrontendProxy()

void Server::setUsingFrontendProxy ( bool enable)

Definition at line 1651 of file server.cpp.

◆ setWebsocketMaxSize()

void Server::setWebsocketMaxSize ( int value)

Definition at line 1492 of file server.cpp.

◆ socketAccess()

QString Server::socketAccess ( ) const
nodiscard

Definition at line 1227 of file server.cpp.

◆ socketRcvbuf()

int Server::socketRcvbuf ( ) const
nodiscard

Definition at line 1486 of file server.cpp.

◆ socketSndbuf()

int Server::socketSndbuf ( ) const
nodiscard

Definition at line 1473 of file server.cpp.

◆ socketTimeout()

int Server::socketTimeout ( ) const
nodiscard

Definition at line 1240 of file server.cpp.

◆ soKeepalive()

bool Server::soKeepalive ( ) const
nodiscard

Definition at line 1460 of file server.cpp.

◆ start()

bool Server::start ( Cutelyst::Application * app = nullptr)

This function will start the server in user application mode.

Use this when you would like to embed the server in an application that is able to start/stop the server at will, for example with a push button.

This method does not support forking which includes master, lazy or processes properties.

New application instances will be created if the app constructor is marked as Q_INVOKABLE and threads settings are greater than 1.

Note
This method does not take ownership of application app.

Definition at line 832 of file server.cpp.

References Server(), errorOccured(), exec(), and QObject::Q_EMIT().

◆ staticMap()

QStringList Server::staticMap ( ) const
nodiscard

Definition at line 1318 of file server.cpp.

◆ staticMap2()

QStringList Server::staticMap2 ( ) const
nodiscard

Definition at line 1331 of file server.cpp.

◆ stop()

void Server::stop ( )

Terminates the server execution, when started with start(), it does nothing when started by exec().

Definition at line 859 of file server.cpp.

References Server(), and QObject::Q_EMIT().

◆ stopped

void Cutelyst::Server::stopped ( )
signal

It is emitted once the server shutdown is completed.

References stopped().

Referenced by Server(), and stopped().

◆ tcpNodelay()

bool Server::tcpNodelay ( ) const
nodiscard

Definition at line 1447 of file server.cpp.

◆ threads()

QString Server::threads ( ) const
nodiscard

Definition at line 1085 of file server.cpp.

◆ touchReload()

QStringList Server::touchReload ( ) const
nodiscard

Definition at line 1374 of file server.cpp.

◆ uid()

QString Server::uid ( ) const
nodiscard

Definition at line 1540 of file server.cpp.

◆ umask()

QString Server::umask ( ) const
nodiscard

Definition at line 1600 of file server.cpp.

◆ upgradeH2c()

bool Server::upgradeH2c ( ) const
nodiscard

Definition at line 1175 of file server.cpp.

◆ usingFrontendProxy()

bool Server::usingFrontendProxy ( ) const
nodiscard

Definition at line 1658 of file server.cpp.

◆ websocketMaxSize()

int Server::websocketMaxSize ( ) const
nodiscard

Definition at line 1499 of file server.cpp.

Property Documentation

◆ application

QString Cutelyst::Server::application
readwrite

Defines application file path to be loaded, an alternative is to provide the Cutelyst::Application pointer to exec().

Accessors:
application(), setApplication()

Definition at line 134 of file server.h.

◆ auto_reload

bool Cutelyst::Server::auto_reload
readwrite

Reload application if the application file is modified or touched.

Accessors:
autoReload(), setAutoReload()

Definition at line 349 of file server.h.

◆ buffer_size

int Cutelyst::Server::buffer_size
readwrite

Defines the buffer size in bytes used when parsing requests. Default value: 4096.

Accessors:
bufferSize(), setBufferSize()

Definition at line 377 of file server.h.

◆ chdir

QString Cutelyst::Server::chdir
readwrite

Defines directory to change into before application loading.

Accessors:
chdir(), setChdir()

Definition at line 167 of file server.h.

◆ chdir2

QString Cutelyst::Server::chdir2
readwrite

Defines directory to change into after application loading.

Accessors:
chdir2(), setChdir2()

Definition at line 250 of file server.h.

◆ chown_socket

QString Cutelyst::Server::chown_socket
readwrite

Defines owner of UNIX sockets.

Accessors:
chownSocket(), setChownSocket()
Note
UNIX only

Definition at line 492 of file server.h.

◆ cpu_affinity

int Cutelyst::Server::cpu_affinity
readwrite

Defines CPU affinity.

Accessors:
cpuAffinity(), setCpuAffinity()
Note
UNIX only

Definition at line 510 of file server.h.

◆ fastcgi_socket

QStringList Cutelyst::Server::fastcgi_socket
readwrite

Defines how an FastCGI socket should be binded.

Accessors:
fastcgiSocket(), setFastcgiSocket()

Definition at line 225 of file server.h.

◆ gid

QString Cutelyst::Server::gid
readwrite

Defines group id of the process.

Accessors:
gid(), setGid()
Note
UNIX only

Definition at line 474 of file server.h.

◆ http2_header_table_size

quint32 Cutelyst::Server::http2_header_table_size
readwrite

Defines the HTTP2 header table size (SETTINGS_HEADER_TABLE_SIZE) default value: 4096.

Accessors:
http2Socket(), setHttp2Socket()

Definition at line 191 of file server.h.

◆ http2_socket

QStringList Cutelyst::Server::http2_socket
readwrite

Defines how an HTTP2 socket should be binded.

Accessors:
http2Socket(), setHttp2Socket()

Definition at line 183 of file server.h.

◆ http_socket

QStringList Cutelyst::Server::http_socket
readwrite

Defines how an HTTP socket should be binded.

Accessors:
httpSocket(), setHttpSocket()

Definition at line 175 of file server.h.

◆ https_h2

bool Cutelyst::Server::https_h2
readwrite

Defines if HTTPS socket should use ALPN to negotiate HTTP/2. Defaults to false.

Accessors:
http2Socket(), setHttp2Socket()

Definition at line 209 of file server.h.

◆ https_socket

QStringList Cutelyst::Server::https_socket
readwrite

Defines how an HTTPS socket should be binded.

Accessors:
httpsSocket(), setHttpsSocket()

Definition at line 217 of file server.h.

◆ ini

QStringList Cutelyst::Server::ini
readwrite

Load config from INI files that will be read by QSettings. When loading multiple files, content will be merged and same keys in the sections will be overwritten by content from later files.

[Cutelst]
home="/path/to/my/home"
[OtherSection]
key=value
Accessors:
ini(), setIni()
See also
config()
Configure your application

Definition at line 271 of file server.h.

◆ json

QStringList Cutelyst::Server::json
readwrite

Load config from JSON files containing a JSON object. When loading multiple files, content will be merged and same keys int the sections will be overwritten by content from later files.

This is only tested for one single root object with flat child objects as config sections.

{
"Cutelyst": {
"home": "/path/to/my/home",
...
},
"OtherSection": {
"key": "value",
...
}
}
Accessors:
json(), setJson()
See also
config()
Configure your application

Definition at line 298 of file server.h.

◆ lazy

bool Cutelyst::Server::lazy
readwrite

Defines is the Application should be lazy loaded.

Accessors:
lazy(), setLazy()

Definition at line 527 of file server.h.

◆ listen

int Cutelyst::Server::listen
readwrite

Defines the socket listen queue size. This setting currently works only on Linux for TCP sockets. Default value: 100.

Accessors:
listenQueue(), setListenQueue()

Definition at line 368 of file server.h.

◆ master

bool Cutelyst::Server::master
readwrite

Defines if a master process should be created to watch for it’s child processes.

Accessors:
master(), setMaster()

Definition at line 341 of file server.h.

◆ no_initgroups

bool Cutelyst::Server::no_initgroups
readwrite

Disable additional groups set via initgroups().

Accessors:
noInitgroups(), setNoInitgroups()
Note
UNIX only

Definition at line 483 of file server.h.

◆ pidfile

QString Cutelyst::Server::pidfile
readwrite

Defines the pid file to be written before privileges drop.

Accessors:
pidfile(), setPidfile()

Definition at line 448 of file server.h.

◆ pidfile2

QString Cutelyst::Server::pidfile2
readwrite

Defines the pid file to be written after privileges drop.

Accessors:
pidfile(), setPidfile()

Definition at line 456 of file server.h.

◆ post_buffering

qint64 Cutelyst::Server::post_buffering
readwrite

Defines the maximum buffer size in bytes of POST request. If a request has a content length that is bigger than the post buffer size, a temporary file is created instead. Default value: -1.

Accessors:
postBuffering(), setPostBuffering()

Definition at line 387 of file server.h.

◆ post_buffering_bufsize

qint64 Cutelyst::Server::post_buffering_bufsize
readwrite

Defines the buffer size in bytes when reading a POST request. Default value: 4096.

Accessors:
postBufferingBufsize(), setPostBufferingBufsize()

Definition at line 396 of file server.h.

◆ processes

QString Cutelyst::Server::processes
readwrite

Defines the number of processes to use, if set to "auto" the ideal processes count is used.

Accessors:
threads(), setThreads()
Note
UNIX only

Definition at line 159 of file server.h.

◆ reuse_port

bool Cutelyst::Server::reuse_port
readwrite

Enable SO_REUSEPORT for the sockets.

Accessors:
reusePort(), setReusePort()
Note
Linux only

Definition at line 519 of file server.h.

◆ so_keepalive

bool Cutelyst::Server::so_keepalive
readwrite

Enable SO_KEEPALIVE for the sockets.

Accessors:
soKeepalive(), setSoKeepalive()

Definition at line 412 of file server.h.

◆ socket_access

QString Cutelyst::Server::socket_access
readwrite

Defines the file permissions of a local socket, u = user, g = group, o = others.

Accessors:
socketAccess(), setSocketAccess()

Definition at line 233 of file server.h.

◆ socket_rcvbuf

int Cutelyst::Server::socket_rcvbuf
readwrite

Sets the socket receive buffer size in bytes at the OS level. This maps to the SO_RCVBUF socket option. Default value: -1.

Accessors:
socketRcvbuf(), setSocketRcvbuf()

Definition at line 432 of file server.h.

◆ socket_sndbuf

int Cutelyst::Server::socket_sndbuf
readwrite

Sets the socket send buffer size in bytes at the OS level. This maps to the SO_SNDBUF socket option. Default value: -1.

Accessors:
socketSndbuf(), setSocketSndbuf()

Definition at line 422 of file server.h.

◆ socket_timeout

int Cutelyst::Server::socket_timeout
readwrite

Defines internal socket timeout in seconds. Defaults to 4.

Accessors:
socketTimeout(), setSocketTimeout()

Definition at line 242 of file server.h.

◆ static_map

QStringList Cutelyst::Server::static_map
readwrite

Defines a list of mountpoint to local path mappings to serve static files. Entries have to be in the form “/mountpoint=/path/to/local/dir”. If there is then a request for eg. /mountpoint/css/style.css, the Server will remove the mountpoint from the request path and will append the rest to the local path to try to find the requested file, like /path/to/local/dir/css/style.css.

Added mappings are automatically sorted by the string length of the mounpoint part from short to long and will be compared to the request path in that order.

Accessors:
staticMap(), setStaticMap()
See also
Serve static files

Definition at line 315 of file server.h.

◆ static_map2

QStringList Cutelyst::Server::static_map2
readwrite

Defines a list of mountpoint to local path mappings to serve static files. Entries have to be in the form “/mountpoint=/path/to/local/dir”. If there ist then a request for eg. /mountpoint/js/script.js, the Server will completely append the request path to the local path to try to find the requested file, like /path/to/local/dir/mountpoint/js/script.js.

Added mappings are automatically sorted by the string length of the mounpoint part from short to long and will be compared to the request path in that order.

Accessors:
staticMap2(), setStaticMap2()
See also
Serve static files

Definition at line 332 of file server.h.

◆ tcp_nodelay

bool Cutelyst::Server::tcp_nodelay
readwrite

Enable TCP NODELAY on each request.

Accessors:
tcpNodelay(), setTcpNodelay()

Definition at line 404 of file server.h.

◆ threads

QString Cutelyst::Server::threads
readwrite

Defines the number of threads to use, if set to "auto" the ideal thread count is used.

Accessors:
threads(), setThreads()

A new thread is only created when > "2" or if "auto" reports more than 1 core, when the number of threads is 2 or more a new thread is not created for the worker 0, it's this way to save allocating a new Application as we already have our current thread.

If it's desired to not have the Server running on the GUI (or current) thread for example, the Server must be moved to a new thread manually.

Definition at line 150 of file server.h.

◆ touch_reload

QStringList Cutelyst::Server::touch_reload
readwrite

Reload application if one of the specified files is modified or touched.

Accessors:
touchReload(), setTouchReload()

Definition at line 357 of file server.h.

◆ uid

QString Cutelyst::Server::uid
readwrite

Defines user id of the process.

Accessors:
uid(), setUid()
Note
UNIX only

Definition at line 465 of file server.h.

◆ umask

QString Cutelyst::Server::umask
readwrite

Defines file mode creation mask.

Accessors:
umask(), setUmask()
Note
UNIX only

Definition at line 501 of file server.h.

◆ upgrade_h2c

bool Cutelyst::Server::upgrade_h2c
readwrite

Defines if an HTTP/1 connection can be upgraded to H2C (HTTP 2 Clear Text). Defaults to false.

Accessors:
http2Socket(), setHttp2Socket()

Definition at line 200 of file server.h.

◆ using_frontend_proxy

bool Cutelyst::Server::using_frontend_proxy
readwrite

Defines if a reverse proxy operates in front of this application server. If enabled, parses the HTTP headers X-Forwarded-For, X-Forwarded-Host and X-Forwarded-Proto and uses this info to update Cutelyst::EngineRequest.

Accessors:
usingFrontendProxy(), setUsingFrontendProxy()

Definition at line 537 of file server.h.

◆ websocket_max_size

int Cutelyst::Server::websocket_max_size
readwrite

Sets the maximum allowed size of websocket messages (in KiB, default 1024).

Accessors:
websocketMaxSize(), setWebsocketMaxSize()

Definition at line 440 of file server.h.