diff options
author | Vsevolod Stakhov <vsevolod@highsecure.ru> | 2016-11-17 12:00:34 +0000 |
---|---|---|
committer | Vsevolod Stakhov <vsevolod@highsecure.ru> | 2016-11-17 12:00:50 +0000 |
commit | 5f384ad7914d9d46de6906714d2b7fb1d9a66f3d (patch) | |
tree | 902b49440cd696d03b9f1bd8421ae0e81d2065aa /src/rspamd_proxy.c | |
parent | d8e7133b3af3e169e894e436c24286d824b255d0 (diff) | |
download | rspamd-5f384ad7914d9d46de6906714d2b7fb1d9a66f3d.tar.gz rspamd-5f384ad7914d9d46de6906714d2b7fb1d9a66f3d.zip |
[CritFix] Fix file mode for rspamd_proxy
Diffstat (limited to 'src/rspamd_proxy.c')
-rw-r--r-- | src/rspamd_proxy.c | 23 |
1 files changed, 22 insertions, 1 deletions
diff --git a/src/rspamd_proxy.c b/src/rspamd_proxy.c index 0b5a5607b..6ef5cc6d0 100644 --- a/src/rspamd_proxy.c +++ b/src/rspamd_proxy.c @@ -150,6 +150,7 @@ struct rspamd_proxy_session { rspamd_inet_addr_t *client_addr; struct rspamd_http_connection *client_conn; gpointer map; + gchar *fname; gpointer shmem_ref; struct rspamd_proxy_backend_connection *master_conn; struct rspamd_http_message *client_message; @@ -875,7 +876,7 @@ proxy_check_file (struct rspamd_http_message *msg, { const rspamd_ftok_t *tok, *key_tok; rspamd_ftok_t srch; - const gchar *file_str; + gchar *file_str; GHashTable *query_args; GHashTableIter it; gpointer k, v; @@ -896,6 +897,7 @@ proxy_check_file (struct rspamd_http_message *msg, } /* Remove header after processing */ rspamd_http_message_remove_header (msg, "File"); + session->fname = file_str; } else { /* Need to parse query URL */ @@ -946,6 +948,7 @@ proxy_check_file (struct rspamd_http_message *msg, rspamd_fstring_free (msg->url); msg->url = new_url; + session->fname = file_str; } g_hash_table_unref (query_args); @@ -1083,12 +1086,21 @@ proxy_open_mirror_connections (struct rspamd_proxy_session *session) if (m->local || rspamd_inet_address_is_local (rspamd_upstream_addr (bk_conn->up))) { + + if (session->fname) { + rspamd_http_message_add_header (msg, "File", session->fname); + } + rspamd_http_connection_write_message_shared (bk_conn->backend_conn, msg, NULL, NULL, bk_conn, bk_conn->backend_sock, bk_conn->io_tv, session->ctx->ev_base); } else { + if (session->fname) { + rspamd_http_message_set_body (msg, session->map, session->map_len); + } + rspamd_http_connection_write_message (bk_conn->backend_conn, msg, NULL, NULL, bk_conn, bk_conn->backend_sock, @@ -1275,6 +1287,11 @@ retry: if (backend->local || rspamd_inet_address_is_local ( rspamd_upstream_addr (session->master_conn->up))) { + + if (session->fname) { + rspamd_http_message_add_header (msg, "File", session->fname); + } + rspamd_http_connection_write_message_shared ( session->master_conn->backend_conn, msg, NULL, NULL, session->master_conn, @@ -1282,6 +1299,10 @@ retry: session->master_conn->io_tv, session->ctx->ev_base); } else { + if (session->fname) { + rspamd_http_message_set_body (msg, session->map, session->map_len); + } + rspamd_http_connection_write_message ( session->master_conn->backend_conn, msg, NULL, NULL, session->master_conn, |