Skip to content

Commit

Permalink
lib-http: change default client/server pool sizes when using SSL
Browse files Browse the repository at this point in the history
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>
  • Loading branch information
Phil Carmody committed Aug 30, 2018
1 parent 9a5b493 commit c00c638
Show file tree
Hide file tree
Showing 2 changed files with 9 additions and 3 deletions.
8 changes: 6 additions & 2 deletions src/lib-http/http-client.c
Expand Up @@ -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;
Expand Down Expand Up @@ -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;
Expand Down
4 changes: 3 additions & 1 deletion src/lib-http/http-server.c
Expand Up @@ -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;

Expand Down

0 comments on commit c00c638

Please sign in to comment.