aboutsummaryrefslogtreecommitdiffstats
path: root/src/libutil
diff options
context:
space:
mode:
Diffstat (limited to 'src/libutil')
-rw-r--r--src/libutil/http.c15
-rw-r--r--src/libutil/http.h7
2 files changed, 22 insertions, 0 deletions
diff --git a/src/libutil/http.c b/src/libutil/http.c
index 1a5bc7840..9e95462b4 100644
--- a/src/libutil/http.c
+++ b/src/libutil/http.c
@@ -1830,6 +1830,21 @@ rspamd_http_connection_set_key (struct rspamd_http_connection *conn,
priv->local_key = kp;
}
+gboolean
+rspamd_http_connection_is_encrypted (struct rspamd_http_connection *conn)
+{
+ struct rspamd_http_connection_private *priv = conn->priv;
+
+ if (priv->peer_key != NULL) {
+ return TRUE;
+ }
+ else if (priv->msg) {
+ return priv->msg->peer_key != NULL;
+ }
+
+ return FALSE;
+}
+
void
rspamd_http_connection_key_unref (gpointer key)
{
diff --git a/src/libutil/http.h b/src/libutil/http.h
index eef963f9d..3ecfc1c99 100644
--- a/src/libutil/http.h
+++ b/src/libutil/http.h
@@ -182,6 +182,13 @@ gpointer rspamd_http_connection_gen_key (void);
void rspamd_http_connection_set_key (struct rspamd_http_connection *conn,
gpointer key);
+/**
+ * Returns TRUE if a connection is encrypted
+ * @param conn
+ * @return
+ */
+gboolean rspamd_http_connection_is_encrypted (struct rspamd_http_connection *conn);
+
/** Print pubkey */
#define RSPAMD_KEYPAIR_PUBKEY 0x1
/** Print secret key */