commit 3e2f344
uint
·
2026-01-30 22:13:39 +0000 UTC
parent 94b7de4
add max_clients option, rename key io_timeout_sec->http_io_timeout, update parados.conf make it match
3 files changed,
+47,
-22
+26,
-21
1@@ -1,10 +1,9 @@
2-# parados.conf
3+# parados.conf
4 # This is the parados configuration file.
5-#
6 # Manual available at parados.conf(5)
7
8-# Core configuration
9-#
10+# *General*
11+
12 # Directory containing media files.
13 #media_dir=/var/media
14 media_dir=/path/to/media
15@@ -14,7 +13,7 @@ media_dir=/path/to/media
16 #
17 # It is recommended to bind on 127.0.0.1 and
18 # host the WebUI on the same network if you
19-# are using one
20+# are using one.
21 #
22 #server_addr=127.0.0.1
23 server_addr=0.0.0.0
24@@ -22,25 +21,13 @@ server_addr=0.0.0.0
25 # TCP port to listen on.
26 server_port=8088
27
28-# Logging
29-#
30-# Enable verbose logging.
31+# Enable verbose logging information.
32 #verbose_log=false
33 verbose_log=true
34
35-# Security
36-#
37-# HTTP IO timeout (in seconds)
38-#
39-# Limits how long the server will block on a single socket read/write.
40-# This does not apply for requests/streaming.
41-# If a client stops sending data or stops reading responses for longer
42-# than this value, the connection is dropped.
43-#
44-# Recommended: LAN=5, WAN/VPN/Mobile=15-30
45-http_io_timeout=5
46+# *Security*
47
48-# Cross-Origin Resource Sharing (CORS)
49+# Cross-Origin Resource Sharing (CORS).
50 #
51 # Controls which web origins may access the API.
52 #
53@@ -51,8 +38,26 @@ http_io_timeout=5
54 #cors_origin=http://127.0.0.1:8000
55 cors_origin=
56
57-# Authentication
58+# *Resource Limits*
59+
60+# HTTP IO timeout (in seconds).
61+#
62+# Limits how long the server will block on a single socket read/write.
63+# This does not apply for requests/streaming.
64+# If a client stops sending data or stops reading responses for longer
65+# than this value, the connection is dropped.
66 #
67+# Recommended: LAN=5, WAN/VPN/Mobile=15-30
68+http_io_timeout=5
69+
70+# Max Clients
71+#
72+# Limits the maximum number of simultaneous client connections
73+# handled by the server.
74+max_clients=64
75+
76+# *Authentication*
77+
78 # Each entry consists of one `user`, `pass`, and (multiple) `allow` directives.
79 # Multiple users are permitted.
80 #
+20,
-1
1@@ -19,6 +19,7 @@ int server_port = 8088;
2 bool verbose_log = true;
3 char cors_origin[1024] = "";
4 int http_io_timeout = 5;
5+int max_clients = 64;
6
7 static int load_path(const char* path)
8 {
9@@ -91,8 +92,10 @@ static int set_kv(const char* k, const char* v)
10 long p = strtol(v, &end, 10);
11 if (!end || *end != '\0')
12 return -1;
13+
14 if (p < 1 || p > 65535)
15 return -1;
16+
17 server_port = (int)p;
18 return 0;
19 }
20@@ -101,6 +104,7 @@ static int set_kv(const char* k, const char* v)
21 bool b;
22 if (parse_bool(v, &b) < 0)
23 return -1;
24+
25 verbose_log = b;
26 return 0;
27 }
28@@ -110,17 +114,32 @@ static int set_kv(const char* k, const char* v)
29 return 0;
30 }
31
32- if (strcmp(k, "io_timeout_sec") == 0) {
33+ if (strcmp(k, "http_io_timeout") == 0) {
34 char* end = NULL;
35 long t = strtol(v, &end, 10);
36 if (!end || *end != '\0')
37 return -1;
38+
39 if (t < 1 || t > 300)
40 return -1;
41+
42 http_io_timeout = (int)t;
43 return 0;
44 }
45
46+ if (strcmp(k, "max_clients") == 0) {
47+ char* end = NULL;
48+ long n = strtol(v, &end, 10);
49+ if (!end || *end != '\0')
50+ return -1;
51+
52+ if (n < 1 || n > 1024)
53+ return -1;
54+
55+ max_clients = (int)n;
56+ return 0;
57+ }
58+
59 /* auth */
60 if (strcmp(k, "user") == 0) {
61 return users_push(v);
+1,
-0
1@@ -9,6 +9,7 @@ extern char cors_origin[1024];
2 extern bool verbose_log;
3 extern int server_port;
4 extern int http_io_timeout;
5+extern int max_clients;
6
7 void config_load(void);
8