@@ -1713,7 +1713,7 @@ rspamd_http_message_write_header (const gchar* mime_type, gboolean encrypted, | |||
"Date: %s\r\n" | |||
"Content-Length: %z\r\n" | |||
"Content-Type: %s", /* NO \r\n at the end ! */ | |||
msg->code, &status, "rspamd/" RVERSION, | |||
msg->code, &status, priv->ctx->config.server_hdr, | |||
datebuf, | |||
bodylen, mime_type); | |||
} | |||
@@ -1725,7 +1725,7 @@ rspamd_http_message_write_header (const gchar* mime_type, gboolean encrypted, | |||
"Server: %s\r\n" | |||
"Date: %s\r\n" | |||
"Content-Length: %z", /* NO \r\n at the end ! */ | |||
msg->code, &status, "rspamd/" RVERSION, | |||
msg->code, &status, priv->ctx->config.server_hdr, | |||
datebuf, | |||
bodylen); | |||
} | |||
@@ -1734,10 +1734,11 @@ rspamd_http_message_write_header (const gchar* mime_type, gboolean encrypted, | |||
rspamd_printf_fstring (buf, | |||
"HTTP/1.1 200 OK\r\n" | |||
"Connection: close\r\n" | |||
"Server: rspamd\r\n" | |||
"Server: %s\r\n" | |||
"Date: %s\r\n" | |||
"Content-Length: %z\r\n" | |||
"Content-Type: application/octet-stream\r\n", | |||
priv->ctx->config.server_hdr, | |||
datebuf, enclen); | |||
} | |||
else { | |||
@@ -1750,7 +1751,7 @@ rspamd_http_message_write_header (const gchar* mime_type, gboolean encrypted, | |||
"Date: %s\r\n" | |||
"Content-Length: %z\r\n" | |||
"Content-Type: %s\r\n", | |||
msg->code, &status, "rspamd/" RVERSION, | |||
msg->code, &status, priv->ctx->config.server_hdr, | |||
datebuf, | |||
bodylen, mime_type); | |||
} | |||
@@ -1762,7 +1763,7 @@ rspamd_http_message_write_header (const gchar* mime_type, gboolean encrypted, | |||
"Server: %s\r\n" | |||
"Date: %s\r\n" | |||
"Content-Length: %z\r\n", | |||
msg->code, &status, "rspamd/" RVERSION, | |||
msg->code, &status, priv->ctx->config.server_hdr, | |||
datebuf, | |||
bodylen); | |||
} |
@@ -92,6 +92,7 @@ rspamd_http_context_new_default (struct rspamd_config *cfg, | |||
static const gdouble default_rotate_time = 120; | |||
static const gdouble default_keepalive_interval = 65; | |||
static const gchar *default_user_agent = "rspamd-" RSPAMD_VERSION_FULL; | |||
static const gchar *default_server_hdr = "rspamd/" RSPAMD_VERSION_FULL; | |||
ctx = g_malloc0 (sizeof (*ctx)); | |||
ctx->config.kp_cache_size_client = default_kp_size; | |||
@@ -99,6 +100,7 @@ rspamd_http_context_new_default (struct rspamd_config *cfg, | |||
ctx->config.client_key_rotate_time = default_rotate_time; | |||
ctx->config.user_agent = default_user_agent; | |||
ctx->config.keepalive_interval = default_keepalive_interval; | |||
ctx->config.server_hdr = default_server_hdr; | |||
ctx->ups_ctx = ups_ctx; | |||
if (cfg) { | |||
@@ -243,6 +245,17 @@ rspamd_http_context_create (struct rspamd_config *cfg, | |||
} | |||
} | |||
const ucl_object_t *server_hdr; | |||
server_hdr = ucl_object_lookup (client_obj, "server_hdr"); | |||
if (server_hdr) { | |||
ctx->config.server_hdr = ucl_object_tostring (server_hdr); | |||
if (ctx->config.server_hdr && strlen (ctx->config.server_hdr) == 0) { | |||
ctx->config.server_hdr = ""; | |||
} | |||
} | |||
const ucl_object_t *keepalive_interval; | |||
keepalive_interval = ucl_object_lookup (client_obj, "keepalive_interval"); |
@@ -40,6 +40,7 @@ struct rspamd_http_context_cfg { | |||
gdouble client_key_rotate_time; | |||
const gchar *user_agent; | |||
const gchar *http_proxy; | |||
const gchar *server_hdr; | |||
}; | |||
/** | |||
@@ -49,7 +50,8 @@ struct rspamd_http_context_cfg { | |||
* @return new context used for both client and server HTTP connections | |||
*/ | |||
struct rspamd_http_context *rspamd_http_context_create (struct rspamd_config *cfg, | |||
struct ev_loop *ev_base, struct upstream_ctx *ctx); | |||
struct ev_loop *ev_base, | |||
struct upstream_ctx *ctx); | |||
struct rspamd_http_context *rspamd_http_context_create_config ( | |||
struct rspamd_http_context_cfg *cfg, |