aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorVsevolod Stakhov <vsevolod@highsecure.ru>2016-05-10 09:27:22 +0100
committerVsevolod Stakhov <vsevolod@highsecure.ru>2016-05-10 09:27:22 +0100
commit1a2ee7300325cb42d756a79c47f4d9752dfdaf01 (patch)
tree91569b5599b6d191edfc48a515d89d03aa8af830
parenta8aedb1603de39cc12574131871e533486421873 (diff)
downloadrspamd-1a2ee7300325cb42d756a79c47f4d9752dfdaf01.tar.gz
rspamd-1a2ee7300325cb42d756a79c47f4d9752dfdaf01.zip
[Feature] Allow to have specific settings for mirrored traffic
-rw-r--r--src/rspamd_proxy.c11
1 files changed, 11 insertions, 0 deletions
diff --git a/src/rspamd_proxy.c b/src/rspamd_proxy.c
index 06192dafc..32a2937e8 100644
--- a/src/rspamd_proxy.c
+++ b/src/rspamd_proxy.c
@@ -69,6 +69,7 @@ struct rspamd_http_upstream {
struct rspamd_http_mirror {
gchar *name;
+ gchar *settings_id;
struct upstream_list *u;
struct rspamd_cryptobox_pubkey *key;
gdouble prob;
@@ -362,6 +363,11 @@ rspamd_proxy_parse_mirror (rspamd_mempool_t *pool,
lua_settop (L, 0);
}
+ elt = ucl_object_lookup_any (obj, "settings", "settings_id", NULL);
+ if (elt && ucl_object_type (elt) == UCL_STRING) {
+ up->settings_id = g_strdup (ucl_object_tostring (elt));
+ }
+
g_ptr_array_add (ctx->mirrors, up);
return TRUE;
@@ -902,6 +908,11 @@ proxy_open_mirror_connections (struct rspamd_proxy_session *session)
rspamd_http_message_remove_header (msg, "Content-Length");
rspamd_http_message_remove_header (msg, "Key");
+ if (m->settings_id != NULL) {
+ rspamd_http_message_remove_header (msg, "Settings-ID");
+ rspamd_http_message_add_header (msg, "Settings-ID", m->settings_id);
+ }
+
bk_conn->backend_conn = rspamd_http_connection_new (
NULL,
proxy_backend_mirror_error_handler,