aboutsummaryrefslogtreecommitdiffstats
path: root/src/libserver/http
diff options
context:
space:
mode:
authorVsevolod Stakhov <vsevolod@highsecure.ru>2021-12-07 18:47:35 +0000
committerVsevolod Stakhov <vsevolod@highsecure.ru>2021-12-07 18:47:35 +0000
commitfe5a7f1829f106b5ca9a901121ea9cc04dab3df6 (patch)
treec133ec949f66c916569cd3ce863108b8567c5aba /src/libserver/http
parentcd9ba26ecb13c50fa3200f7d80394cdfd8b0089a (diff)
downloadrspamd-fe5a7f1829f106b5ca9a901121ea9cc04dab3df6.tar.gz
rspamd-fe5a7f1829f106b5ca9a901121ea9cc04dab3df6.zip
[Minor] Try to fix keepalive for SSL connections
Diffstat (limited to 'src/libserver/http')
-rw-r--r--src/libserver/http/http_connection.c39
1 files changed, 18 insertions, 21 deletions
diff --git a/src/libserver/http/http_connection.c b/src/libserver/http/http_connection.c
index e3e32eef8..0a5dee754 100644
--- a/src/libserver/http/http_connection.c
+++ b/src/libserver/http/http_connection.c
@@ -2303,29 +2303,26 @@ rspamd_http_connection_write_message_common (struct rspamd_http_connection *conn
return FALSE;
}
else {
- if (priv->ssl) {
- /* Cleanup the existing connection */
- rspamd_ssl_connection_free (priv->ssl);
- }
-
- priv->ssl = rspamd_ssl_connection_new (ssl_ctx, priv->ctx->event_loop,
- !(msg->flags & RSPAMD_HTTP_FLAG_SSL_NOVERIFY),
- conn->log_tag);
- g_assert (priv->ssl != NULL);
+ if (!priv->ssl) {
+ priv->ssl = rspamd_ssl_connection_new (ssl_ctx, priv->ctx->event_loop,
+ !(msg->flags & RSPAMD_HTTP_FLAG_SSL_NOVERIFY),
+ conn->log_tag);
+ g_assert (priv->ssl != NULL);
- if (!rspamd_ssl_connect_fd (priv->ssl, conn->fd, host, &priv->ev,
- priv->timeout, rspamd_http_event_handler,
- rspamd_http_ssl_err_handler, conn)) {
+ if (!rspamd_ssl_connect_fd (priv->ssl, conn->fd, host, &priv->ev,
+ priv->timeout, rspamd_http_event_handler,
+ rspamd_http_ssl_err_handler, conn)) {
- err = g_error_new (HTTP_ERROR, 400,
- "ssl connection error: ssl error=%s, errno=%s",
- ERR_error_string (ERR_get_error (), NULL),
- strerror (errno));
- rspamd_http_connection_ref (conn);
- conn->error_handler (conn, err);
- rspamd_http_connection_unref (conn);
- g_error_free (err);
- return FALSE;
+ err = g_error_new (HTTP_ERROR, 400,
+ "ssl connection error: ssl error=%s, errno=%s",
+ ERR_error_string (ERR_get_error (), NULL),
+ strerror (errno));
+ rspamd_http_connection_ref (conn);
+ conn->error_handler (conn, err);
+ rspamd_http_connection_unref (conn);
+ g_error_free (err);
+ return FALSE;
+ }
}
}
}