summaryrefslogtreecommitdiffstats
path: root/src
diff options
context:
space:
mode:
authorVsevolod Stakhov <vsevolod@highsecure.ru>2019-07-18 15:36:38 +0100
committerVsevolod Stakhov <vsevolod@highsecure.ru>2019-07-18 15:36:38 +0100
commit8c0dfd28675d6ff2a1d8d7166750acde69fbd15a (patch)
treefcf0403fa60c9c7b3b5c55926d0ff805586609c1 /src
parent1755ad1ce5a0165f08f1b4d778f198d652d48b9c (diff)
downloadrspamd-8c0dfd28675d6ff2a1d8d7166750acde69fbd15a.tar.gz
rspamd-8c0dfd28675d6ff2a1d8d7166750acde69fbd15a.zip
[Minor] Do not add User-Agent if it exists
Diffstat (limited to 'src')
-rw-r--r--src/libutil/http_connection.c11
1 files changed, 9 insertions, 2 deletions
diff --git a/src/libutil/http_connection.c b/src/libutil/http_connection.c
index 9bf7456e7..d653758cf 100644
--- a/src/libutil/http_connection.c
+++ b/src/libutil/http_connection.c
@@ -1965,8 +1965,15 @@ rspamd_http_connection_write_message_common (struct rspamd_http_connection *conn
}
if (priv->ctx->config.user_agent && conn->type == RSPAMD_HTTP_CLIENT) {
- rspamd_http_message_add_header (msg, "User-Agent",
- priv->ctx->config.user_agent);
+ struct rspamd_http_header *found = NULL;
+
+ HASH_FIND (hh, msg->headers, "User-Agent",
+ sizeof ("User-Agent") - 1, found);
+
+ if (!found) {
+ rspamd_http_message_add_header (msg, "User-Agent",
+ priv->ctx->config.user_agent);
+ }
}
if (encrypted) {