diff options
author | Daniel Baumann <daniel.baumann@progress-linux.org> | 2024-04-27 18:24:29 +0000 |
---|---|---|
committer | Daniel Baumann <daniel.baumann@progress-linux.org> | 2024-04-27 18:24:29 +0000 |
commit | df4528d6668ab18e40584fe540355bdfba0fb6dd (patch) | |
tree | f1bfdcb6485edff853369405dd5423c662c47345 /debian/patches/civetweb-755-1.8-somaxconn-configurable.patch | |
parent | Adding upstream version 14.2.21. (diff) | |
download | ceph-df4528d6668ab18e40584fe540355bdfba0fb6dd.tar.xz ceph-df4528d6668ab18e40584fe540355bdfba0fb6dd.zip |
Adding debian version 14.2.21-1.debian/14.2.21-1debian
Signed-off-by: Daniel Baumann <daniel.baumann@progress-linux.org>
Diffstat (limited to 'debian/patches/civetweb-755-1.8-somaxconn-configurable.patch')
-rw-r--r-- | debian/patches/civetweb-755-1.8-somaxconn-configurable.patch | 53 |
1 files changed, 53 insertions, 0 deletions
diff --git a/debian/patches/civetweb-755-1.8-somaxconn-configurable.patch b/debian/patches/civetweb-755-1.8-somaxconn-configurable.patch new file mode 100644 index 00000000..8313b3ec --- /dev/null +++ b/debian/patches/civetweb-755-1.8-somaxconn-configurable.patch @@ -0,0 +1,53 @@ +Description: Makes SOMAXCONN user-configurable. +Author: Jesse Williamson <jesse.williamson@canonical.com> +Origin: upstream, https://github.com/civetweb/civetweb/pull/776/commits/febab7dc38c9671577603425c54c20f841e27f97 +Bug: https://github.com/civetweb/civetweb/issues/775 +Bug-Ubuntu: https://bugs.launchpad.net/ubuntu/+source/ceph/+bug/1838109 +--- +This patch header follows DEP-3: http://dep.debian.net/deps/dep3/ +--- a/src/civetweb/src/civetweb.c ++++ b/src/civetweb/src/civetweb.c +@@ -1541,10 +1541,6 @@ typedef int socklen_t; + #define MSG_NOSIGNAL (0) + #endif + +-#if !defined(SOMAXCONN) +-#define SOMAXCONN (100) +-#endif +- + /* Size of the accepted socket queue */ + #if !defined(MGSQLEN) + #define MGSQLEN (20) +@@ -2063,6 +2059,7 @@ enum { + SSL_CERTIFICATE, + SSL_CERTIFICATE_CHAIN, + NUM_THREADS, ++ SO_MAX_CONNECTIONS, + RUN_AS_USER, + URL_REWRITE_PATTERN, + HIDE_FILES, +@@ -2165,6 +2162,7 @@ static struct mg_option config_options[] + {"ssl_certificate", CONFIG_TYPE_FILE, NULL}, + {"ssl_certificate_chain", CONFIG_TYPE_FILE, NULL}, + {"num_threads", CONFIG_TYPE_NUMBER, "50"}, ++ {"max_connections", CONFIG_TYPE_NUMBER, "100"}, + {"run_as_user", CONFIG_TYPE_STRING, NULL}, + {"url_rewrite_patterns", CONFIG_TYPE_STRING_LIST, NULL}, + {"hide_files_patterns", CONFIG_TYPE_EXT_PATTERN, NULL}, +@@ -13340,7 +13338,15 @@ set_ports_option(struct mg_context *ctx) + continue; + } + +- if (listen(so.sock, SOMAXCONN) != 0) { ++ char *p = ctx->config[SO_MAX_CONNECTIONS]; ++ long opt_max_connections = strtol(p, NULL, 10); ++ if(opt_max_connections > INT_MAX || opt_max_connections < 1) { ++ mg_cry(fc(ctx), ++ "max_connections value \"%s\" is invalid", p); ++ continue; ++ } ++ ++ if (listen(so.sock, (int)opt_max_connections) != 0) { + + mg_cry(fc(ctx), + "cannot listen to %.*s: %d (%s)", |