summaryrefslogtreecommitdiff
path: root/include
diff options
context:
space:
mode:
authorAzat Khuzhin <azat@libevent.org>2020-05-25 11:25:18 +0300
committerAzat Khuzhin <azat@libevent.org>2020-05-25 11:25:18 +0300
commit7426a568d009c34fbef9ab607aedab9d05fc29ec (patch)
treec3f4c08ea3a293f2e6d497866409ab7e7ba52a7d /include
parentf10aaea37433b60ed3e0b7adcc7b1764c8b0b518 (diff)
parent95c1c200c182d96f49930a15ad433a7049e61b06 (diff)
downloadlibevent-7426a568d009c34fbef9ab607aedab9d05fc29ec.tar.gz
http: Merge branch 'http-max_connections-pr-592'
@jcoffland: "When the max connection limit is enabled and the limit is reached, the server will respond immediately with 503 Service Unavailable. This can be used to prevent servers from running out of file descriptors. This is better than request limiting because clients may make more than one request over a single connection. Blocking a request does not necessarily close the connection and free up a socket." * http-max_connections-pr-592: test: cover evhttp max connections Added evhttp max simultaneous connection limiting
Diffstat (limited to 'include')
-rw-r--r--include/event2/http.h18
1 files changed, 18 insertions, 0 deletions
diff --git a/include/event2/http.h b/include/event2/http.h
index 7d4d2881..eba8f237 100644
--- a/include/event2/http.h
+++ b/include/event2/http.h
@@ -224,6 +224,24 @@ EVENT2_EXPORT_SYMBOL
void evhttp_set_max_body_size(struct evhttp* http, ev_ssize_t max_body_size);
/**
+ * Set the maximum number of simultaneous connections for this server.
+ * A value of zero or less disables the limit.
+ *
+ * @param http the http server on which to set the max connection limit
+ * @param max_connections the maximum number of simultaneous connections or 0
+ */
+EVENT2_EXPORT_SYMBOL
+void evhttp_set_max_connections(struct evhttp* http, int max_connections);
+
+/**
+ * Get the current number of connections.
+ *
+ * @return The current number of connections for this server.
+ */
+EVENT2_EXPORT_SYMBOL
+int evhttp_get_connection_count(struct evhttp* http);
+
+/**
Set the value to use for the Content-Type header when none was provided. If
the content type string is NULL, the Content-Type header will not be
automatically added.