commit fe5a7f1: [Minor] Try to fix keepalive for SSL connections
Vsevolod Stakhov
vsevolod at highsecure.ru
Tue Dec 7 18:49:04 UTC 2021
Author: Vsevolod Stakhov
Date: 2021-12-07 18:47:35 +0000
URL: https://github.com/rspamd/rspamd/commit/fe5a7f1829f106b5ca9a901121ea9cc04dab3df6 (HEAD -> master)
[Minor] Try to fix keepalive for SSL connections
---
src/libserver/http/http_connection.c | 39 +++++++++++++++++-------------------
1 file 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;
+ }
}
}
}
More information about the Commits
mailing list