Cutelyst  2.3.0
Signals | Public Member Functions | Properties | List of all members
CWSGI::WSGI Class Reference

Implements a WSGI server. More...

#include <Cutelyst/WSGI>

Inheritance diagram for CWSGI::WSGI:
Inheritance graph
[legend]

Signals

void changed ()
 
void ready ()
 
void stopped ()
 

Public Member Functions

 WSGI (QObject *parent=nullptr)
 
QString application () const
 
bool autoReload () const
 
int bufferSize () const
 
QString chdir () const
 
QString chdir2 () const
 
QString chownSocket () const
 
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
 
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
 
void setApplication (const QString &application)
 
void setAutoReload (bool enable)
 
void setBufferSize (qint64 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 &ini)
 
void setJson (const QStringList &files)
 
void setLazy (bool enable)
 
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 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 setWebsocketMaxSize (int value)
 
QString socketAccess () const
 
int socketRcvbuf () const
 
int socketSndbuf () const
 
int socketTimeout () const
 
bool soKeepalive () const
 
bool start (Cutelyst::Application *app=nullptr)
 This function will start the WSGI server in user application mode. More...
 
QStringList staticMap () const
 
QStringList staticMap2 () const
 
void stop ()
 Terminates the server execution, when started with start(), it does nothing when started by exec().
 
bool tcpNodelay () const
 
QString threads () const
 
QStringList touchReload () const
 
QString uid () const
 
QString umask () const
 
bool upgradeH2c () const
 
int websocketMaxSize () const
 

Properties

QString application
 
bool auto_reload
 
qint64 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
 
bool master
 
bool no_initgroups
 
QString pidfile
 
QString pidfile2
 
qint64 post_buffering
 
qint64 post_buffering_bufsize
 
QString processes
 
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
 
int websocket_max_size
 

Detailed Description

Definition at line 38 of file wsgi.h.

Member Function Documentation

◆ exec()

int CWSGI::WSGI::exec ( Cutelyst::Application app = nullptr)

This function will start the WSGI server.

If an application is provided it will ignore the value of setApplication and/or the Application configuration in case Ini 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).

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.

◆ ready

void CWSGI::WSGI::ready ( )
signal

It is emitted once the server is ready.

◆ start()

bool CWSGI::WSGI::start ( Cutelyst::Application app = nullptr)

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.

Currentl

◆ stopped

void CWSGI::WSGI::stopped ( )
signal

It is emitted once the server shutdown is completed.

Property Documentation

◆ application

QString CWSGI::WSGI::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 91 of file wsgi.h.

◆ auto_reload

bool CWSGI::WSGI::auto_reload
readwrite

Reload application if the application file is modified or touched

Accessors:
autoReload(), setAutoReload()

Definition at line 248 of file wsgi.h.

◆ buffer_size

qint64 CWSGI::WSGI::buffer_size
readwrite

Defines the buffer size used when parsing requests

Accessors:
bufferSize(), setBufferSize()

Definition at line 264 of file wsgi.h.

◆ chdir

QString CWSGI::WSGI::chdir
readwrite

Defines directory to chdir to before application loading

Accessors:
chdir(), setChdir()

Definition at line 117 of file wsgi.h.

◆ chdir2

QString CWSGI::WSGI::chdir2
readwrite

Defines directory to chdir to after application loading

Accessors:
chdir2(), setChdir2()

Definition at line 199 of file wsgi.h.

◆ chown_socket

QString CWSGI::WSGI::chown_socket
readwrite

Defines owner of UNIX sockets.

Accessors:
chownSocket(), setChownSocket()

Definition at line 370 of file wsgi.h.

◆ cpu_affinity

int CWSGI::WSGI::cpu_affinity
readwrite

Defines CPU affinity

Accessors:
cpuAffinity(), setCpuAffinity()

Definition at line 386 of file wsgi.h.

◆ fastcgi_socket

QStringList CWSGI::WSGI::fastcgi_socket
readwrite

Defines how an FastCGI socket should be binded

Accessors:
fastcgiSocket(), setFastcgiSocket()

Definition at line 175 of file wsgi.h.

◆ gid

QString CWSGI::WSGI::gid
readwrite

Defines group id of the process.

Accessors:
gid(), setGid()

Definition at line 354 of file wsgi.h.

◆ http2_header_table_size

quint32 CWSGI::WSGI::http2_header_table_size
readwrite

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

Accessors:
http2Socket(), setHttp2Socket()

Definition at line 141 of file wsgi.h.

◆ http2_socket

QStringList CWSGI::WSGI::http2_socket
readwrite

Defines how an HTTP2 socket should be binded

Accessors:
http2Socket(), setHttp2Socket()

Definition at line 133 of file wsgi.h.

◆ http_socket

QStringList CWSGI::WSGI::http_socket
readwrite

Defines how an HTTP socket should be binded

Accessors:
httpSocket(), setHttpSocket()

Definition at line 125 of file wsgi.h.

◆ https_h2

bool CWSGI::WSGI::https_h2
readwrite

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

Accessors:
http2Socket(), setHttp2Socket()

Definition at line 159 of file wsgi.h.

◆ https_socket

QStringList CWSGI::WSGI::https_socket
readwrite

Defines how an HTTPS socket should be binded

Accessors:
httpsSocket(), setHttpsSocket()

Definition at line 167 of file wsgi.h.

◆ ini

QStringList CWSGI::WSGI::ini
readwrite

Load config from ini file

Accessors:
ini(), setIni()

Definition at line 207 of file wsgi.h.

◆ json

QStringList CWSGI::WSGI::json
readwrite

Load config from JSON file

Accessors:
json(), setJson()

Definition at line 215 of file wsgi.h.

◆ lazy

bool CWSGI::WSGI::lazy
readwrite

Defines is the Application should be lazy loaded.

Accessors:
lazy(), setLazy()

Definition at line 405 of file wsgi.h.

◆ master

bool CWSGI::WSGI::master
readwrite

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

Accessors:
master(), setMaster()

Definition at line 240 of file wsgi.h.

◆ no_initgroups

bool CWSGI::WSGI::no_initgroups
readwrite

Disable additional groups set via initgroups()

Accessors:
noInitgroups(), setNoInitgroups()

Definition at line 362 of file wsgi.h.

◆ pidfile

QString CWSGI::WSGI::pidfile
readwrite

Defines the pid file to be written before privileges drop

Accessors:
pidfile(), setPidfile()

Definition at line 329 of file wsgi.h.

◆ pidfile2

QString CWSGI::WSGI::pidfile2
readwrite

Defines the pid file to be written before privileges drop

Accessors:
pidfile(), setPidfile()

Definition at line 337 of file wsgi.h.

◆ post_buffering

qint64 CWSGI::WSGI::post_buffering
readwrite

Defines the maximum buffer size of POST request, if a request has a content length that is bigger than the post buffer size a temporary file is created instead

Accessors:
postBuffering(), setPostBuffering()

Definition at line 273 of file wsgi.h.

◆ post_buffering_bufsize

qint64 CWSGI::WSGI::post_buffering_bufsize
readwrite

Defines the buffer size when reading a POST request

Accessors:
postBufferingBufsize(), setPostBufferingBufsize()

Definition at line 281 of file wsgi.h.

◆ processes

QString CWSGI::WSGI::processes
readwrite

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

Accessors:
threads(), setThreads()

Definition at line 108 of file wsgi.h.

◆ so_keepalive

bool CWSGI::WSGI::so_keepalive
readwrite

Enable SO_KEEPALIVE for the sockets

Accessors:
soKeepalive(), setSoKeepalive()

Definition at line 297 of file wsgi.h.

◆ socket_access

QString CWSGI::WSGI::socket_access
readwrite

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

Accessors:
socketAccess(), setSocketAccess()

Definition at line 183 of file wsgi.h.

◆ socket_rcvbuf

int CWSGI::WSGI::socket_rcvbuf
readwrite

Sets the socket receive buffer size in bytes at the OS level. This maps to the SO_RCVBUF socket option

Accessors:
socketRcvbuf(), setSocketRcvbuf()

Definition at line 313 of file wsgi.h.

◆ socket_sndbuf

int CWSGI::WSGI::socket_sndbuf
readwrite

Sets the socket send buffer size in bytes at the OS level. This maps to the SO_SNDBUF socket option

Accessors:
socketSndbuf(), setSocketSndbuf()

Definition at line 305 of file wsgi.h.

◆ socket_timeout

int CWSGI::WSGI::socket_timeout
readwrite

Defines set internal socket timeout

Accessors:
socketTimeout(), setSocketTimeout()

Definition at line 191 of file wsgi.h.

◆ static_map

QStringList CWSGI::WSGI::static_map
readwrite

Map the mountpoint to static directory (or file)

Accessors:
staticMap(), setStaticMap()

Definition at line 223 of file wsgi.h.

◆ static_map2

QStringList CWSGI::WSGI::static_map2
readwrite

Map the mountpoint to static directory (or file), completely appending the requested resource to the docroot

Accessors:
staticMap2(), setStaticMap2()

Definition at line 231 of file wsgi.h.

◆ tcp_nodelay

bool CWSGI::WSGI::tcp_nodelay
readwrite

Enable TCP NODELAY on each request

Accessors:
tcpNodelay(), setTcpNodelay()

Definition at line 289 of file wsgi.h.

◆ threads

QString CWSGI::WSGI::threads
readwrite

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

Accessors:
threads(), setThreads()

Definition at line 99 of file wsgi.h.

◆ touch_reload

QStringList CWSGI::WSGI::touch_reload
readwrite

Reload application if the specified file is modified or touched

Accessors:
touchReload(), setTouchReload()

Definition at line 256 of file wsgi.h.

◆ uid

QString CWSGI::WSGI::uid
readwrite

Defines user id of the process.

Accessors:
uid(), setUid()

Definition at line 346 of file wsgi.h.

◆ umask

QString CWSGI::WSGI::umask
readwrite

Defines file mode creation mask

Accessors:
umask(), setUmask()

Definition at line 378 of file wsgi.h.

◆ upgrade_h2c

bool CWSGI::WSGI::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 150 of file wsgi.h.

◆ websocket_max_size

int CWSGI::WSGI::websocket_max_size
readwrite

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

Accessors:
websocketMaxSize(), setWebsocketMaxSize()

Definition at line 321 of file wsgi.h.