"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);
}
"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);
}
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 {
"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);
}
"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);
}
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;
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) {
}
}
+ 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");
gdouble client_key_rotate_time;
const gchar *user_agent;
const gchar *http_proxy;
+ const gchar *server_hdr;
};
/**
* @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,