]> git.ipfire.org Git - thirdparty/dovecot/core.git/commitdiff
lib-http: change default client/server pool sizes when using SSL
authorPhil Carmody <phil@dovecot.fi>
Tue, 19 Jun 2018 10:28:12 +0000 (13:28 +0300)
committerTimo Sirainen <timo.sirainen@open-xchange.com>
Fri, 15 Feb 2019 12:48:41 +0000 (12:48 +0000)
SSL carries a lot of state with it, so just start with a bigger
pool if we know we're using it.

Signed-off-by: Phil Carmody <phil@dovecot.fi>
src/lib-http/http-client.c
src/lib-http/http-server.c

index d25902a0d37f96a766a5870a5b5e512054c7dc84..4c724513d246b133a7b9961d7641131eb57e4e20 100644 (file)
@@ -106,8 +106,10 @@ http_client_init_shared(struct http_client_context *cctx,
        struct http_client *client;
        const char *log_prefix;
        pool_t pool;
+       size_t pool_size;
 
-       pool = pool_alloconly_create("http client", 1024);
+       pool_size = (set != NULL && set->ssl != NULL) ? 8192 : 1024; /* certs will be >4K */
+       pool = pool_alloconly_create("http client", pool_size);
        client = p_new(pool, struct http_client, 1);
        client->pool = pool;
        client->ioloop = current_ioloop;
@@ -429,8 +431,10 @@ http_client_context_create(const struct http_client_settings *set)
 {
        struct http_client_context *cctx;
        pool_t pool;
+       size_t pool_size;
 
-       pool = pool_alloconly_create("http client context", 1024);
+       pool_size = (set->ssl != NULL) ? 8192 : 1024; /* certs will be >4K */
+       pool = pool_alloconly_create("http client context", pool_size);
        cctx = p_new(pool, struct http_client_context, 1);
        cctx->pool = pool;
        cctx->refcount = 1;
index 747d424902c55d0f88e0a677292a1952145eac0b..89940434d5f6aa55b81099d4c82d35c56e2a3b54 100644 (file)
@@ -24,8 +24,10 @@ struct http_server *http_server_init(const struct http_server_settings *set)
 {
        struct http_server *server;
        pool_t pool;
+       size_t pool_size;
 
-       pool = pool_alloconly_create("http server", 1024);
+       pool_size = (set->ssl != NULL) ? 10240 : 1024; /* ca/cert/key will be >8K */
+       pool = pool_alloconly_create("http server", pool_size);
        server = p_new(pool, struct http_server, 1);
        server->pool = pool;
        if (set->rawlog_dir != NULL && *set->rawlog_dir != '\0')