struct rspamd_http_connection_router * new;
struct stat st;
- new = g_slice_alloc (sizeof (struct rspamd_http_connection_router));
+ new = g_slice_alloc0 (sizeof (struct rspamd_http_connection_router));
new->paths = g_hash_table_new (rspamd_strcase_hash, rspamd_strcase_equal);
new->conns = NULL;
new->error_handler = eh;
return new;
}
+void
+rspamd_http_router_set_key (struct rspamd_http_connection_router *router,
+ gpointer key)
+{
+ struct rspamd_http_keypair *kp = (struct rspamd_http_keypair *)key;
+
+ g_assert (key != NULL);
+ REF_RETAIN (kp);
+
+ router->key = key;
+}
+
void
rspamd_http_router_add_path (struct rspamd_http_connection_router *router,
const gchar *path, rspamd_http_router_handler_t handler)
0,
RSPAMD_HTTP_SERVER);
+ if (router->key) {
+ rspamd_http_connection_set_key (conn->conn, router->key);
+ }
+
rspamd_http_connection_read_message (conn->conn, conn, fd, router->ptv,
router->ev_base);
LL_PREPEND (router->conns, conn);
struct timeval *ptv;
struct event_base *ev_base;
gchar *default_fs_path;
+ gpointer key;
rspamd_http_router_error_handler_t error_handler;
rspamd_http_router_finish_handler_t finish_handler;
};
struct event_base *base,
const char *default_fs_path);
+/**
+ * Set encryption key for the HTTP router
+ * @param router router structure
+ * @param key opaque key structure
+ */
+void rspamd_http_router_set_key (struct rspamd_http_connection_router *router,
+ gpointer key);
+
/**
* Add new path to the router
*/