-
Notifications
You must be signed in to change notification settings - Fork 1
Expand file tree
/
Copy pathHttpServerConfig
More file actions
124 lines (93 loc) · 2.91 KB
/
HttpServerConfig
File metadata and controls
124 lines (93 loc) · 2.91 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
/*
* Copyright (C) 2021 Frank Mertens.
*
* Distribution and use is allowed under the terms of the GNU General Public License version 3
* (see CoreComponents/LICENSE-gpl-3.0).
*
*/
#pragma once
#include <cc/HttpLoggingServiceInstance>
#include <cc/HttpServiceInstance>
#include <cc/TlsServerOptions>
#include <cc/SocketAddress>
#include <cc/MetaObject>
namespace cc {
/** \class HttpServerConfig cc/HttpServerConfig
* \ingroup http_server
* \brief Configuration for the HTTP server
*/
class HttpServerConfig: public Object
{
public:
/** HTTP server configuration prototype
*/
static MetaObject prototype();
/** Parse HTTP sever configuration from \a text
*/
static MetaObject parse(const String &text);
/** Create a null HTTP server configuration
*/
HttpServerConfig() = default;
/** Load a HTTP server configuration from \a config
*/
explicit HttpServerConfig(const MetaObject &config);
/** Load a HTTP server configuration by parsing \a text (YASON format)
*/
explicit HttpServerConfig(const String &text);
/** Add an instance of the directory service serving files from \a path
*/
void addDirectoryInstance(const String &path);
/** Add an instance of the echo service
*/
void addEchoInstance();
/** %List of socket addresses the server is listening on
*/
List<SocketAddress> address() const;
/** %Transport layer security is required
*/
bool forceSecureTransport() const;
/** Configured TLS port
*/
long securePort() const;
/** Name of user to switch to for server operation
*/
String user() const;
/** Name of group to switch to for server operation
*/
String group() const;
/** HTTP server version string (server identification)
*/
String version() const;
/** Daemonize process on server startup
*/
bool daemon() const;
String daemonName() const;
/** %File path to use to store the process ID
*/
String pidPath() const;
/** Number of parallel connections to serve simultanously
*/
long concurrency() const;
long serviceWindow() const;
/** Maximum number of simultanous connections allowed from a single source
*/
long connectionLimit() const;
/** Maximum time to wait for a request on a stale connection
*/
double connectionTimeout() const;
int connectionTimeoutMs() const;
/** TLS options
*/
TlsServerOptions tlsOptions() const;
const HttpLoggingServiceInstance &errorLoggingInstance() const;
const HttpLoggingServiceInstance &accessLoggingInstance() const;
/** Configured HTTP service instances
*/
List<HttpServiceInstance> serviceInstances() const;
HttpServiceInstance selectService(const String &host, const String &uri = "") const;
private:
struct State;
State &me();
const State &me() const;
};
} // namespace cc